Im not going to pretend to know what is happening here, so I'll just explain how to duplicate it.
I have a demo (https://dojo.telerik.com/iQEtE). Monitor the web console.
1. Create an event, at 10:30am (for example).
2. Resize the event so it starts at 10:00
In the console, I've printed the event object which displays the start time as 10:00, the new time of the event. But on the next line I've explicitly printed the start value and it reads as 10:30, the original time.
I have no idea what is happening, please advise.
4 Answers, 1 is accepted
This isn't an issue I don't believe. In my own scheduler, I just checked and confirmed that in the moveEnd function, the e.event has the original times (before moving), but the e.start and e.end are the correct times.
This modify dojo has a dataBound and dataBinding event in your Scheduler. You will see that dataBinding happens after the moveEnd, and dataBound follows dataBinding. When you look at the event in the dataBinding function (under e.items), the times are the new times you moved the event to.
I believe what is happening is that the event is not updated and synced at the time you print the event in the moveEnd. It then gets synced to the new times in dataBinding.
Also, the e.event and e.event.start console.log/error both print the original time of 10:30am.
So, I believe things are fine. The event updates and moves and stays in the correct time slot, and the time gets correctly set in the dataBinding event for that event.
The reason for the observed difference is the fact, that the logged e.event object on the console keeps a reference to the event object stored in the Scheduler DataSource. At the time when the event handler is executed both values are equal. Nevertheless, when you click to expand the logged event object, as it actually holds a reference to the event object, the updated time will be seen.
Here you will find a modified version of the Dojo, which demonstrates the above. In order to keep all the values in the e.event object as they are at the time of execution of the event, I am converting to JSON string this object. You will notice that the ISO date string for the start field is the same as the one logged from the following expression: console.error(e.event.start.toISOString());
The time fields in the e.event object will always keep their initial value. As Tyler mentioned, the updated values could found in the e.start and e.end fields.
Thanks for the explanation it really clears things up. As both yourself and Tyler suggested, I've updated my work to use e.start and e.end instead.
Thank you for bringing the missing information from our API reference to our attention. I have just added the discussed fields to the resizeEnd event description and they will be live very soon.
As a small token of gratitude for helping us to improve our documentation, I have updated your Telerik points.