Collision with custom fields


I’m using dhtmlxScheduler to reserve rooms and projectors for different teams.

I’d like to set up collision system to avoid reserving a room or a projector in two different events at the same time.
Every data are stored in my database, i have an id for teams, another for rooms, and a last for projectors.

Must I use collision system or anything else ?

Thank you in advance for your answers.

Best Regards


Built in collision detection will work as you wish ( will take in account not only time, but some shared resource ) only in unit and timeline views. In such modes it will allow multiple events in the same time, if they are belong to different resources.

More info about collision extension … llisions&s[]=collision

Is it possible to apply this kind of collision detection to day, week or month view ?
Or when I create an event, verify if another one exists at the same time, with a same option ?


By default collision will react on time-clash in any views. But it will ignore is it the same resource or different one.

You need to customize process a bit.

[code]scheduler.attachEvent(“onEventCollision”, function(ev, evs){
// here evs - array of events object which share the same time
// you can check is they belong to same resource or to different ones

if (same_resource(evs)) return true; //block operation
else return true; //allow operation


I tried collisions with the function bellow, but I don’t know with which object I have to compare my IDs to test with every events in the same time period.

scheduler.attachEvent("onEventCollision",function(F,E){ if(E.id_video == ?.id_video) return true; else return false; });

With an example, it will be easier :
I have 2 events in one day
One of them uses the projector 1 from 10 to 12
The second one uses the projector 2 from 9 to 11

I’m adding a new event the same day from 10 to 11, with the projector 1. Then it will be impossible, because the first event uses this projector in the same time.
How could I test events present in the time period ?
E is for the new event, which variable must I use to test existent events ?

I hope that is understandable.


you can use

scheduler.attachEvent("onEventCollision",function(F,E){ for (var i=0; i<E.length; i++) if(E[i].id_video == F.id_video) return true; return false; });

It works very well, thank you.

I have a last question, about month view. I would like to add end_date for each event.
“start_date - end_date event_title”
Where can I modify this ?

templates.scheduler.event_bar_date = function(start,end,ev){ return scheduler.templates.event_date(start)+" - "+scheduler.templates.event_date(end); };


Sorry to use an old thread, but my question is the following.
Collisons doesn’t work with full days events.

The for loop doesn’t use thoses events to compare with current event.

Do you have any ideas ?

Do you have a solution for my issue ?

I have always collisions with full day events en normal events.