Hello,
I have an error when i drag and drop an event.
It's works fine for one drag and the second this error appear.
I don't know what the problem is, I updated the schedule to version 5.1.0 and since then I have this error.
Sorry, it's complicated to make a test case of my project. I will try. But I think my problem may be the way I populate the schedule.
"this.schedu" is my scheduler.
this.schedulerService.interWorkers.pipe(takeUntil(this.destroyed$)).subscribe(
data => {
this.interWorkers = data;
const e = new EventStore({
modelClass: InterventionWorkerSchedulerGpModel as any,
data: this.interWorkers
});
const assig: any[] = [];
this.interWorkers.forEach(ap => {
ap.resourceIds.forEach(r => {
const a: any = {
resourceId: r,
eventId: ap.id
};
assig.push(a);
});
});
this.schedu.assignments = assig;
this.schedu.eventStore = e;
}
);
This happened because of the way you set data into the scheduler.
First of all we highly recommend to use wrappers for work with frameworks. Please see https://bryntum.com/docs/scheduler/guide/Scheduler/quick-start/angular
https://bryntum.com/docs/scheduler/guide/Scheduler/integration/angular/guide
Second, you set eventStore class after scheduler initialized which is not necessary in your case and looks weird. If you want to work with inline data, please see https://bryntum.com/docs/scheduler/guide/Scheduler/integration/angular/data-binding
And the main problem is that when you replace a full eventStore instance with already created records after assignments data, it causes this problem. Basically, it's race condition because of such approach. Assignments check if any events available with id defined and set a link with assigned resource to event record. But in your case events are not there at the moment and more than that it won't happen after you set events as well, because you replaced full eventStore.
In 2 words, try to set assignments data after eventStore replacement.
this.scheduler.eventStore = e;
this.scheduler.assignments = assig;
But I highly recommend to read our guides and update your code to not have problems in the future
Good luck!
All the best,
Alex