Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Yell on Oct 21, 2009 02:15
open dhtmlx forum
one more question about dhtmlxScheduler

Hi, I used dhtmlxScheduler to build a weekly planner, and i defined some event types, such as internal meeting, annual leave etc.

i wanna set a limitation: some types of events cannot be deleted, so i add codes like this:

scheduler.attachEvent("onBeforeEventDelete", function(event_id,event_object){
             if(scheduler._loading) return;
            
             if(event_object.event_type<=7 && event_object.event_type>=4 && event_object.start_date<new Date()){
                 alert("You can not delete the event!");
                 return false;
             }else{
                scheduler.deleteEvent(event_id,true);
                return true;
             }
});

when i click delete button, the warning info may pop up twice, but the event is still deleted, i read the document and found onBeforeEventDelete is blockable, i don't know it clearly.

can you tell me what's wrong with my code or how to realize this kind of functions?

thank you very much!
Answer posted by Alex (support) on Oct 21, 2009 08:30

Hello, 

the issue wasn'r reproduced with the latest scheduler version. Do you use the latest one ?

Answer posted by Stanislav (support) on Oct 21, 2009 12:26
By the way, the next commands in your code is incorrect

scheduler.deleteEvent(event_id,true);
return true;

you need not call deleteEvent, just return true and it will be deleted automatically