Our pure JavaScript Scheduler component


Post by plo »

Hello,
I am trying to remove an event from the scheduler completely. First of all I am using a ProjectModel to load the data in the scheduler, so would it be right to do project.eventStore or scheduler.eventStore function?
This is the ProjectModel:

const project = new ProjectModel({
		eventModelClass : FixedDurationEvent,
		loadUrl: '/index.php/ressources/scheduler_data',
		autoLoad: true,
		stm: {
			autoRecord: true,
		}
	});

Right now I do below code, but I keep getting the message:
"Duplicate assignment of event 4420 to resource user_1".

var event = project.eventStore.getById(response.data.id);
project.eventStore.remove(event);
project.assignmentStore.unassignEventFromResource(event);
Attachments
Screenshot_34.png
Screenshot_34.png (158.53 KiB) Viewed 46 times

Post by ghulam.ghous »

Hi there,

Instead of this code:

var event = project.eventStore.getById(response.data.id);
project.eventStore.remove(event);
project.assignmentStore.unassignEventFromResource(event);

You should be simply able to remove the event and all its assignments by just passing the id to remove method. https://bryntum.com/products/schedulerpro/docs/api/Scheduler/data/EventStore#function-remove

project.eventStore.remove(response.data.id)

This should remove all the assignments for the event. About

would it be right to do project.eventStore or scheduler.eventStore function?

You can use either. Both approaches are fine. If the above is not working for you, can you please share a small runnable test case with us?

Regards,
Ghous


Post Reply