Preventing events collisions

In many use-cases you may need to limit count of events per time slot, for example - deny creation of the second event if one event has been already defined at that time. To automate such a task the “collision” extension can be used.

To activate extension you need to include the related js file

<script src="codebase/ext/dhtmlxscheduler_collision.js"></script>

Actually that is all. From that point scheduler won't allow to create a new event or move any existent event to the timezone which is occupied by another one.

If you need to have more than one event per a time slot, you can set the collision_limit property:

scheduler.config.collision_limit = 2; //allows 2 events per a time slot

If attempt to create an event in the occupied time slot is detected, the scheduler will generate onEventCollision event

With recurring events, the extension works from version 2.3+.

Limiting date-scale

This extension allows to limit active dates ( a user won't be able to see the dates outside defined date or to create events during not-active dates )

To activate extension you need to include the dhtmlxscheduler_limit.js file

<script src="codebase/ext/dhtmlxscheduler_limit.js"></script>

and define the range:

scheduler.config.limit_start = new Date(-3999,0,0);
scheduler.config.limit_end   = new Date( 3999,0,0);

If the scheduler detects an attempt to create an event with non-allowed date, onLimitViolation event will be generated.

If you need to block not only event creation, but viewing as well , you can use

scheduler.config.limit_view  = true;

With recurring events, the extension works from version 2.3+.

Work hours limiting

In addition to the above technique, more advanced configuration can be done, to define work hours limits for specific dates ( hours in which you allow|deny new event creation )

To activate extension you need to include the dhtmlxscheduler_limit.js file

<script src="codebase/ext/dhtmlxscheduler_limit.js"></script>

After that you can use

//disallows any event for specific day
scheduler.blockTime(new Date(2009,5,30), "fullday");
//disallows events from 0 till 10 hours, for specific date
scheduler.blockTime(new Date(2009,6,3), [0,10*60]);
//disallows events from 0 till 8 and from 18 till 24 hours, for saturday
scheduler.blockTime(6, [0,8*60,18*60,24*60]);
//disallows any event for specific week-day (sunday)
scheduler.blockTime(0, "fullday");