Hi,
In the context menu I have an element called "Edit event"
When I click this, I want to trigger the editEvent dialog
Please refer the image
Simply call our editEvent API on the Scheduler instance: https://www.bryntum.com/docs/scheduler/#Scheduler/view/SchedulerBase#function-editEvent
Im inside the config code. In this code I have a context menu (NOT the eventContextMenu), which has a menu item called "Edit Event". When I click on this, I need to open the event editor.
This is my Code.
const scheduler = {
id: 'unallocated-work-grid',
startDate: new Date(2019, 8, 1, 6),
endDate: new Date(2019, 11, 1, 6),
viewPreset: 'weekAndDay',
barMargin: 5,
rowHeight: 40,
emptyText: 'Fetching records...',
showRemoveRowInContextMenu: false,
createEventOnDblClick: false,
features: {
contextMenu: {
cellItems: [
{
text: 'Edit event',
onItem: ({ item }) => console.log(item.text),
},
{
text: 'Custom Menu item',
onItem: ({ item }) => console.log(item.text),
},
],
},
},
};
Basically, what I need is to get the eventEdit item which is by default in the eventContextMenu to the contextmenu
Thank you!
Hello, you can get resource in the parameters. And then you can get its events. Just need to decide what event to edit:
const scheduler = new Scheduler({
showRemoveRowInContextMenu : false,
createEventOnDblClick : false,
features : {
contextMenu : {
cellItems : [
{
text : 'Edit event',
onItem : ({ item, record }) => {
console.log(item.text, record.events);
// choose somehow what event you want to edit, since there can be any or none
if (record.events.length) {
scheduler.editEvent(record.events[0]);
}
else {
alert('No events to edit!');
}
}
}
]
}
},
Cheers!
Pavlo Miklashevych
Sr. Frontend Developer