Hi,
Is it possible to define the item text of the eventContextMenu depend on some property of the selected event.
For Example, I have in my model, a property called "eventStatus", and i need to change the item text depend on the the status of the selected event.
How can i control it?
Please assist..
Support Forum
Have you seen the example here: https://bryntum.com/docs/scheduler/#Scheduler/feature/EventContextMenu titled Manipulate existing items for all events or specific events?
Hi Saki,
I anted to change the text only, not to manipulate the item.
I've tried it, however the "processItems" event wont accept access to my service. (i have service that translate the text to the selected languages.)
I anted to change the text only, not to manipulate the item.
I've tried it, however the "processItems" event wont accept access to my service. (i have service that translate the text to the selected languages.)
this.schedulerConfig.eventContextMenu = {
triggerEvent: 'click',
processItems({ eventRecord, items }) {
switch (eventRecord.data.allocationStatus) {
case ResourceAllocationStatus.Tentative:
items.openDispatch = {
text: this.bksUtilsService.getTranslate("DISPATCH");
};
break;
case ResourceAllocationStatus.Approved:
items.openDispatch = {
text: this.bksUtilsService.getTranslate("RETURN");
};
break;
default:
break;
}
},
items: {
showEventDetails: {
text: this.bksUtilsService.getTranslate("SHOW_EVENT_DETAILS"),
icon: 'b-fa-info-circle',
cls: 'scheduler-menu-item',
onItem({ eventRecord }) {
_this.openShowEventDetailScreen(eventRecord.eventId);
}
},
customEditEvent:
{
text: this.bksUtilsService.getTranslate("EDIT_EVENT"),
icon: 'b-fa-edit',
cls: 'scheduler-menu-item',
onItem({ eventRecord }) {
_this.openEditEventScreen(eventRecord.eventId);
}
},
openDispatch: {
text: this.bksUtilsService.getTranslate("DISPATCH"),
icon: 'b-fa-plane-departure',
cls: 'scheduler-menu-item',
onItem({ eventRecord, resourceRecord }) {
_this.openDispatch(eventRecord.eventId, eventRecord.data, resourceRecord.data);
}
},
editAllocation: false,
deleteEvent: false
}
};
Hello.
What do you expect this to point to? Any chance you forgot to use closure? Like
What do you expect this to point to? Any chance you forgot to use closure? Like
const me = this;
this.schedulerConfig.eventContextMenu = {
triggerEvent: 'click',
processItems({ eventRecord, items }) {
switch (eventRecord.data.allocationStatus) {
case ResourceAllocationStatus.Tentative:
items.openDispatch = {
text: me.bksUtilsService.getTranslate("DISPATCH");
};
break;
case ResourceAllocationStatus.Approved:
items.openDispatch = {
text: me.bksUtilsService.getTranslate("RETURN");
};
break;
default:
break;
}
}
};