I’m having trouble iterating through the values returned from getRecDates. It is merely listing it as an Object. I believe that it is an array but cannot seem to look through it like a normal array. Here is some code:
scheduler.attachEvent(“onEventSave”, function (a, b) {
var dates = scheduler.getRecDates(b.id,1000);
for (var i = 0; i < dates.length; i++) {
alert(“dates[” + i + “] is =>’” + dates[i] + “’”);
}
var c = this.getEvent(a);
if (!c.rec_type && b.rec_type && (a + “”).indexOf("#") == -1) this._select_id = null; return !0
});
getRecDates returns array of objects, each object has start_date and end_date properties:
[
{ start_date: date, end_date: date },
{ start_date: next_date, end_date: next_date },
...
]
Please note that in onEventSave event you won’t receive full list of event occurrences.
If you want to do it after save operation ends you can try to use onAfterLightbox event, it is called when lightbox is closed and edit operation is fully finished ( onEventSave called when saving operation starts )
I will try that. The point is that we have to decipher all dates scheduled (insert/update/delete) into a format that does not use rec_dates (i.e., one record per scheduled event).
Yep, sorry for incorrect suggestion.
Try to use
onEventAdded
onEventChanged
handlers, they are occurs after edit operation finished, and both provide the event id.
I’m not sure what is wrong then. Here is what I have:
scheduler.attachEvent(“onEventAdded”, function (a) {
var dates = scheduler.getRecDates(a, 1000);
alert(dates.length); // RETURNS 0
}
This should work, right? When I alert(a); it displays a very long number if that helps.
Ok. This is what I see. Changed seems to work as expected because it has the actual id for getRecDates but Added only gets a temp ID (long number). Is there a way during Added to get the actual db ID for getRecDates?