Premium support for our pure JavaScript UI components


Post by cpritchard »

Currently in our project, we only want to allow users to "add" either a task successor or predecessor.
By default the add context menu includes Task Above, Task Below, Milestone, Subtask.

I know that I can disable the add menu all together by settings its value to false, but what if I simply want to just hide/disable some of the default options?

Something like:

initTaskContextMenuConfig(): Partial<TaskMenuConfig> {
	return {
		items: {
			add: {
			     taskAbove: false,
			     taskBelow: false,
			     milestone: false,
			     subtask: false
			}
		}
	}
}

Is my only option to disabled the default Add menu option and re-create it myself by re-implementing the the add successor and predecessor functions?

Thats really not ideal and would open us up to introducing unnecessary bugs.
Please provide your feedback,
Thanks.


Post by alex.l »

Please see an example in docs https://bryntum.com/products/gantt/docs/api/Gantt/feature/TaskMenu#remove-menusubmenu-items

const gantt = new Gantt({
    features : {
        taskMenu : {
            items : {
                // Hide delete task option
                deleteTask: false,

            // Hide item from the `add` submenu
            add: {
                menu: {
                     subtask: false
                }
            }
        }
    }
}
});

All the best,
Alex


Post Reply