scheduler.on({
eventDrop: ({source, eventRecords, context}) => {
if (context.unAssignedTask) {
//Data from another schedule
let resources = unassigned_scheduler.resources;
for (let resource of resources) {
if (resource.id === context.record.id) {
resource.remove()
break;
}
}
}else{
let eventRecord=eventRecords[0];
eventRecord.startDate=eventRecord.originalData.startDate;
eventRecord.endDate=eventRecord.originalData.endDate;
}
},
afterEventDrop:({source,eventRecords,context}) => {
if (context.unAssignedTask){
let eventRecord=eventRecords[0];
let events=scheduler.events;
for (let event of events){
if (event.data.dragId===context.record.id) {
event.startDate=eventRecord.originalData.startDate;
event.endDate=eventRecord.originalData.endDate;
}
}
}
}
});
As you can see on the eventDrop options I am setting startdate and enddate of eventrecord to originaleventrecord. This works fine when I move event withing one scheduler but it doesn't work while move the data between two scheduler . I want to set the startdate and endate and move the event to proper position but it stays in the position where I drop it. Currently I have workaround for this but is there more efficient way of doing this?