Hi, does anyone know if it is possible to add an event that can not start on a blocked day but can go straight through it. For Example: Have all Sundays blocked but allow an event from a Saturday through to a Monday. This is to be used for a vehicle rental system.
Hello,
you can define a handler for onLimitViolation event, it triggers each time scheduler each time scheduler blocks event creation/edition. docs.dhtmlx.com/scheduler/api__s ⊠event.html
In the handler you can check whether the eventâs start/end dates are out of the blocked time, and if so - allow event placement. scheduler.checkLimitViolation takes an event object as an argument, so youâll need to create a temporary object with start/end_date properties and probably section id, and test it with .checkLimitViolation method
[code]scheduler.attachEvent(âonLimitViolationâ, function (id, event){
if(event.probe) return false;
var allowedStart = scheduler.checkLimitViolation({
start_date:event.start_date,
end_date: scheduler.date.add(event.start_date, scheduler.config.time_step, "minute"),
probe:true//checkLimitViolation invokes onLimitViolation event. Add a property to detect when it's happens by our call
});
var allowedEnd = scheduler.checkLimitViolation({
start_date:scheduler.date.add(event.end_date, -scheduler.config.time_step, "minute"),
end_date: event.end_date,
probe:true
});
if(allowedStart && allowedEnd){
return true;
}else{
return false;
}
Hi, thats fantastic, thanks for your help. One final point though is that when dragging a normal event it shows the lightbox as I want it to but when dragging over a blocked date it does not show the lightbox, can you help with this also?
Hi, sorry, I was a little unclear, when creating an event by dragging it over a blocked day it does not show the lightbox. When dragging within a normal time period it does show the lightbox. it also wonât open the lightbox on doubleclick when it lays over the top of a blocked day. Iâm using the following lines of configuration: