We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

isSlotAvailable returns false from within scheduleObject.saveEvent()

Hi,
when I check if the slot is available in onActionBegin for an existing event from the editor, isSlotAvailable() returns true.
If I programmatically change the event and call saveEvent(data), the same function with the same parameters returns false in onActionBegin:

console.log(data.StartTime, typeof(data.StartTime), data.EndTime, groupIndex, typeof(groupIndex),
                getScheduleObject().isSlotAvailable(data.StartTime, data.EndTime, groupIndex));

Through the Editor:
Wed Mar 20 2019 08:00:00 GMT+0000 (Greenwich Mean Time), Wed Mar 20 2019 10:00:00 GMT+0000 (Greenwich Mean Time), 1, true
Through saveEvent()
Wed Mar 20 2019 08:00:00 GMT+0000 (Greenwich Mean Time), Wed Mar 20 2019 10:00:00 GMT+0000 (Greenwich Mean Time), 1, false

e.g.
getScheduleObject().getEvents()[0].Subject = "Some Changed Subject here" // << (Event exists!)
getScheduleObject().saveEvent(getScheduleObject().getEvents()[0])

Editing the same event through the editor (making the same change, e.g .to the Subject), works fine.

Could you please point me towards my error?
Thanks!

3 Replies

ST Stefan March 19, 2019 03:14 PM UTC

It's the same whether accessing ..getEvents[index] or ..eventsData[index].

What is funny is that the Guid appears to change on the event. From Editor:
EndTime: Wed Mar 20 2019 10:00:00 GMT+0000 (Greenwich Mean Time) {}
EndTimezone: null
Guid: "19cc52ba-7c1a-b5d4-7b55-00aadafaa366"
Id: 2094
IsBlockAppointment: false
IsReadOnly: false

From saveEvent()
EndTime: Wed Mar 20 2019 10:00:00 GMT+0000 (Greenwich Mean Time) {}
Guid: "ba6faeb8-a22b-9fad-796e-8a96ca7bb37a"
Id: 2094
IsBlockAppointment: false
IsReadOnly: false

Guid is different, Start and EndTimeZone is null from Editor, but not there at all from saveChanges().  RecurrenceRule: null from saveChanges(), but undefined from Editor. This is slightly weird...


ST Stefan March 20, 2019 11:48 AM UTC

After looking through the code, I could see that isSlotAvailable compares the guid to Schedule.activeEventData.event.

So in theory this should work until the bug is fixed:
let eventToModify = getScheduleObject().getEvents()[0];
eventToModify.Subject = "Some Changed Subject here"
getScheduleObject().activeEventData.event = eventToModify;
getScheduleObject().saveEvent(eventToModify);

Will I have to combat any side effects if I go down this path? Can I leave the "element" as undefined, or as whatever it is at that time?


KK Karthigeyan Krishnamurthi Syncfusion Team March 20, 2019 12:37 PM UTC

Hi Stefan,


Thank you for contacting Syncfusion support.

We could reproduce the reported issue and logged the below bug report. Fix will be included in JS2 weekly release on or before April 9, 2019.


Regards,
Karthi

Loader.
Live Chat Icon For mobile
Up arrow icon