I tried the following:
const self = this;
self.contextMenuAllOptions = new DayPilot.Menu({
items: [
{
text: Resource.getLabel("cancelBooking"),
onclick() { self.cancelBooking(this.source); }
},
{
text: Resource.getLabel("lockBooking"),
onclick() { self.lockBooking(this.source); }
},
{
text: Resource.getLabel("addToClipboard"),
onclick() { self.addToClipboard(this.source); }
}
]
});
self.contextMenuNoCancel = new DayPilot.Menu({
items: [
{
text: Resource.getLabel("lockBooking"),
onclick() { self.lockBooking(this.source); }
},
{
text: Resource.getLabel("addToClipboard"),
onclick() { self.addToClipboard(this.source); }
}
]
});
and then in the onBeforeEventRender event:
//if (args.data.trans_no > 0) {
// args.ContextMenuClientName = this.contextMenuNoCancel.ClientObjectName;
//}
//else {
// args.ContextMenuClientName = this.contextMenuAllOptions.ClientObjectName;
//}
If I leave this code uncommented, my events don't even show up.
What do I need to have dynamic options in the menu depending on the event's data content?