Hi,
what version of the scheduler do you use?
You can check following example
scheduler/samples/03_extensions/25_advanced_limitation.html
‘checkLimitViolation’ works properly there
But if i create an event for Saturday programmatically with :
scheduler.addEvent(...);
The event is created but it shoudn’t.
I can check afterwards if the event can or cannot be created with this function :
scheduler.attachEvent("onLimitViolation", function (event_id, event_object) {
scheduler.deleteEvent(event_id);
alert("An event cannot be created here");
return false;
});
But how can I check before the creation of the event?
Thanks in advance.
Hello,
i’ve just downloaded v3.7 package from the site, have added marked timespan and onLimitViolation handler as in your code abowe.
Everything works as expected, I can’t add event in blocked area neither programmatically nor by mouse actions.
The example is attached, am I missing something? 25_advanced_limitation.zip (1.58 KB)
I tried your solution after downloading the Scheduler 3.7.
I cannot create an event with mouse actions (double click, drag move, …) on weekends but…
the event is created on saturday when i click on the button and an alert is shown :
You’re right, I did not notice that event stays in blocked area after you close the alert.
Looks like currently you should check check limit violation manually before calling .addEvent
if(scheduler.checkLimitViolation(event_obj)){
scheduler.addEvent(event_obj);
}
We’ll investigate the problem, probably fix will be included in next version of the scheduler. But for now .checkLimitViolation should be called manually before adding events programmatically
In case of dhtmlxscheduler, checkLimitViolation is defined in ext/dhtmlxscheduler_limit.js
If this file was included ( after dhtmlxscheduler.js ) - scheduler must have the method in question.
I have a similar issue where I want to prevent externalDragIn event (from tree control) to create event for a blocked time range. I tried to use checkLimitViolation but I get following error:
TypeError: scheduler.checkLimitViolation is not a function
I have included dhtmlxscheduler_limit.js file. I can block time span successfully. Only problem is with checkLimitViolation function.
I am using version 3.7 Standard.
Thanks,
Nasir
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan