[code] // if update fails restore event to original position or delete if it's new
dp.attachEvent("onAfterUpdate", function(sid, action, tid, response){
if (action == "error"){
switch(response.getAttribute("oper"))
{
case "updated":
break;
case "inserted":
break;
case "deleted":
break;
default:
// event unknown operation (do nothing)
break;
}
}
});[/code]
I tried using scheduler.updateEvent(sid) but it seems the object containing the data of the deleted event is no longer present and I don’t know which event to use to cancel the delete operation.
It will remove visual marking from the event and will not try to remove it from DB anymore
( event object is not deleted from scheduler until confirmation, it only marked as “need-to-be-deleted” )
A solution I found is to parse the deleted event again. I coudn’t see any problem yet, as the deleted event is being replaced with the new parsed event (with the same attributes as id, start_date, etc) and functionality is not affected. for example I can drag and drop the event to a new spot. Anyway if someone came up with a better solution please let me know.
[code]// if update fails restore event to original position or delete if it’s new
dp.attachEvent(“onAfterUpdate”, function(sid, action, tid, response){
if (action == “error”){
switch(response.getAttribute("oper"))
{
case "updated":
break;
case "inserted":
break;
case "deleted":
scheduler.parse([{
"id":sid,
"start_date":$.fn.formatDateTime(scheduler.getEventStartDate(sid)),
"end_date":$.fn.formatDateTime(scheduler.getEventEndDate(sid)),
"text":scheduler.getEventText(sid)}] ,
"json");
break;
default:
// event unknown operation (do nothing)
break;
}
}
});[/code]
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan