Hello!
Is there a way to silently edit recurring event? Now, when I try to drag/remove an instance of recurring event, scheduler automatically creates a new event and fires js event. Can I somehow disable it?
I generate json for scheduler based on some custom server-side logic and handle creating/editing/removing events. But it is a bit difficult to find out what action was fired (Was it update of recurring evt or creation of a new one).
My code is:
scheduler.attachEvent("onBeforeEventChanged", function(ev, e, flag, ev_old){
if (!flag) { //old event moved
updateEvent(ev.id, ev.event_pid, formatDate(ev.start_date), formatDate(ev.end_date), '', formatDate(ev_old.start_date), ev.rec_type, ev.text);
} else { //new evt created
if ((ev.id+'').indexOf("#") !== -1) {//recurring event instance
console.log("onBeforeEventChanged ###");
return false;
}
return true;
}
return false;
});
scheduler.attachEvent("onBeforeEventDelete", function(id,ev){
if (id.indexOf("#") !== -1) {//recurring event instance
setTimeout(function(){
updateEvent(ev.id, ev.event_pid, formatDate(ev.start_date), formatDate(ev.end_date), ev.event_length, formatDate(ev.start_date), 'none', ev.text);
},1); //timeout value doesn't matter
} else {
setTimeout(function(){
deleteEvent(id);
},1); //timeout value doesn't matter
}
return false;
});
scheduler.attachEvent("onEventAdded", function(id,ev){
var start = formatDate(ev.start_date);
var end = formatDate(ev.end_date)
setTimeout(function(){
createNewEvent(start, end);
},1); //timeout value doesn't matter
return true;
});
createNewEvent(), updateEvent(), deleteEvent() are JS functions that do partial update triggered by client side script.
Btw, It does same things event when I move normal event.
When user edits a single event of the series, scheduler creates an ‘exception’, the event for which the recurring rule of the series does not apply. This is by the design and cannot be changed.
On the server you can inspect rec_type and event_pid properties of the post data, in order to catch such cases:
For modified instance it will look like following:
!nativeeditor_status : “inserted”
event_pid : seriesId
rec_type : “”
And for deleted:
!nativeeditor_status : “inserted”
event_pid : seriesId
rec_type : “none”
Where seriesId is an id of the related series of events.
docs.dhtmlx.com/scheduler/recurr … ntheseries
If I return false in onBeforeEventDelete handler it stops all further activities and no new event is being created. I wonder if there is something similar to that?