The onShow event handler is called before the context menu is displayed. You can use the event handler to dynamically modify the context menu depending on the source object.
DayPilot.Menu.onShow(args);
This example disables the first menu item if the source event has a readonly tag specified.
dp.events.list = [ id: 1, text: "Event 1", start: "2024-10-01", end: "2024-10-03", resource: "R1", tags: { readonly: true } ]; dp.contextMenu = new DayPilot.Menu({ items: [ { text: "Edit...", onClick: function(args) { console.log("Showing details...") } } ], onShow: function(args) { var e = args.source; if (e.data.tags && e.data.tags.readonly) { args.menu.items[0].disabled = true; } else { args.menu.items[0].disabled = false; } } });