Our pure JavaScript Scheduler component
Team,
I am trying to call a custom method in the context menu of the event in the scheduler but it doesnt mae a call to the function.
eventContextMenuFeature : {
items: {
deleteEvent: false,
eventEdit: false,
Redirect: {
text: 'FindIn:',
icon: 'b-fa b-fa-fw b-fa-search',
onItem({ eventRecord }) {
const testId = eventRecord.id;
findRecord(testId); // OnItem of scheduler does not call custom method
},
}
}
alex,
If you see my code above, I am not able to call a custom method in the onItem block of the contextMenu of event.
Hope you got my issue
Thanks.
I've tested it in angular and normal demos, works normally. Are you sure method is not called? Add a console.log(eventId)
there and see if it gets logged?
maxim, Onitem method gets called,
But inside the OnItem I am not able to call any custom method. For ex. findRecord(testId) is a custom method I am calling inside Onitem
eventContextMenuFeature : {
items: {
deleteEvent: false,
eventEdit: false,
Redirect: {
text: 'FindIn:',
icon: 'b-fa b-fa-fw b-fa-search',
onItem({ eventRecord }) {
const testId = eventRecord.id;
findRecord(testId); // OnItem of scheduler does not call custom method
},
}
}
You need to make sure that findRecord
fn is avaliable in the scope of the callback. How you do it is up to you, it depends on your app.
problem is binding to this context for component, that is possible with fat arrow syntax like so:
items.previousDay = {
text: 'Bla bla',
icon: 'b-fa b-fa-fw b-fa-arrow-left',
onItem: (event)[b] => [/b]this.handleContextMenuMoveEvent(event, TaskMoveEnum.MOVE_TO_PREV_DAY)
};
So all working ok for you now?