Перейти к основному содержимому

onBeforeContextMenu

Description​

Fires before the built-in context menu opens

onBeforeContextMenu: (context: IContextMenuEventContext) => void | boolean

Parameters​

  • context - the target zone, related data and resolved menu items

Example​

gantt.attachEvent("onBeforeContextMenu", function (context) {
if (context.zone === "task" && context.task?.readonly) {
context.items = context.items.filter(item => item.id !== "delete");
}
return true;
});

Details​

Requires the context menu plugin. Gantt resolves the items before calling the handler. Assign or mutate context.items to change the menu. Return false or leave the item list empty to skip the built-in menu.

Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.