Calendar events not updating
9 years ago.
Hi,
I'm making use of the following code to update the calendar control, but the events aren't being updated? Not sure why...
// ... loop for each time entry
// construct a new day pilot event object
var event = new DayPilot.Event({
start: new DayPilot.Date(timeEntry.TimeDate).addHours(appConfig.defaultWorkdayStart + cachedTime),
end: new DayPilot.Date(timeEntry.TimeDate)
.addHours(appConfig.defaultWorkdayStart + timeEntry.TimeHours + cachedTime),
id: timeEntry.TimeId,
text: timeEntry.TimeDescription,
tags: {
meta: timeEntry,
color: timeEntry.color
},
resource: timeEntry.ClientId,
backColor: getBackColorByStatus(timeEntry)
});
// check whether the calendar control already contains the specific event
if (vm.calendar.events.find(event.id()) == undefined) {
// if not, add
vm.calendar.events.add(event);
} else {
// if so, update
vm.calendar.events.update(event);
}
// ...loop end
vm.calendar.update();
Could you please assist?
Many thanks in advance!
DayPilot