I have DayPilot.Scheduler having multiple events.
I need to update real Event ID after handle from Server, Server will return the real Event ID
I will replace EventID from ui() with Event Id from Server.
But I have a problem that, not all the Events in Scheduler are updated.
Here is my code:
var Events = dpPrdPkg.events.list;
if (Events.length > 0) {
for (var i = 0; i < Events.length; i++) {
var CurrentEv = dpPrdPkg.events.find(Events[i].id);
$.ajax({
type: "POST",
async: true,
url: Url,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
if (response.length == 3) {
if (response[0] !== "" && response[1] !== "") {
value = 1;
/* Update Client-side */
for (var i = 0; i < dpPrdPkg.events.list.length; i++) {
var e = dpPrdPkg.events.list[i];
if (e.id == response[0]) {
e.id = response[1];
/*2018/04/07: replace Bubble-HTML */
e.bubbleHtml = e.bubbleHtml.replace(e.id, response[1]);
dpPrdPkg.update();
}
}
} else {
dpPrdPkg.message(response[2]);
}
}
}, error: function (response) {
dpPrdPkg.message("Approve Event FAILED " + response.text);
}
});
}
}
Thank in advance,
Thomas Lee