onEventCollision not running when updating an event

When I go on to the editor box for an event, and press the save button, if there is a colliding event, it runs onEventCollision.
That works fine.

But when I run the following code myself, I would expect onEventCollision to run, as it is effectively the same as editing an event, but the function doesn’t run.

Here is the code:

scheduler.getEvent(eventID).approved = approve.toString(); scheduler.updateEvent(eventID); dp.setUpdated(eventID, true, "updated");

Is there something else I need to add so that onEventCollision will run when that code is run if there is a colliding event?

you can manually call collision check: var result = scheduler.checkCollision(ev);//returns true/false

The code you gave me just checks if the event is colliding with another, but doesn’t call my custom ‘onEventCollision’ code.
How can I do that?

.checkCollision checks whether event collides with other events of the calendar. If it does - the method fires ‘onEventCollision’ event for each collision. Does it works differently in your application?

Just fixed it.

I didn’t realise that in scheduler.checkCollision(ev); ‘ev’ has to be the event object, not the event id.

I changed it and it now works.

Btw, that’s a really useful function, but it’s not in the documentation.
You should add it in, as it can come in very handy!

Actually it must trigger the related event, when collision occurs

//update event var ev = scheduler.getEvent(eventID); ev.approved = approve.toString(); //run collision check var result = scheduler.checkCollision(ev);