onEventCollision does not work


#1

Hello,

For a long time I have been trying to get the scheduler collision system to work, but it only works the first time when loading with lines:

scheduler.attachEvent (“onEventLoading”, function (ev) {
return scheduler.checkCollision (ev);
});

I put the js file for the collisions and I set the collision_limit configuration to 1 but as soon as I move an event the onEventCollision does not seem to be executed.

Note that I am in a vuejs project and that I had to import the lib in the asset folder because it was impossible to import it via npm because the css file was not working.

Do you have any idea what the problem is?
thank you


#2

Hello @jcauz ,

The provided fragment works only on event loading, because you are using the onEventLoading event(which fires only when the event is loaded).

If you want to check the collision for other actions(like event update, save eta) you can use the onEventCollision event:
https://docs.dhtmlx.com/scheduler/api__scheduler_oneventcollision_event.html

scheduler.attachEvent("onEventCollision", function (ev, evs){
    //any custom logic here
    return true;
});

Live demo:
http://snippet.dhtmlx.com/5/d08f43286

Or manually check collision from the onBeforeEventChanged, onEventSave, onEventDrag, onDragEnd and similar events, here is the full list of scheduled events:
https://docs.dhtmlx.com/scheduler/api__refs__scheduler_events.html


#3

Hello,

Thank you for your reply.

I did try to use onEventCollision but it just doesn’t apply.

When I wanted to use the onBeforeEventChanged, onEventSave, onEventDrag, onDragEnd events I had the same problem they do not work or do not allow me to cancel the move for example in the case of onEventEnd.

Do you have any solutions?

Thank you