This is a migrated thread and some comments may be shown as answers.

Date discrepancy when moving/resizing events

4 Answers 117 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Grant asked on 17 Oct 2017, 11:09 AM

Hi, 

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.

Thanks,
Grant

4 Answers, 1 is accepted

Sort by
0
Tyler
Top achievements
Rank 1
answered on 17 Oct 2017, 01:46 PM

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. 

0
Accepted
Veselin Tsvetanov
Telerik team
answered on 19 Oct 2017, 06:39 AM
Hi Grant,

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.

Regards,
Veselin Tsvetanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 19 Oct 2017, 11:44 AM

Hi Veselin, 

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.

Just a heads up in the scheduler API the resizeEnd event does not mention that it has start and end date like the moveEnd does. (https://docs.telerik.com/kendo-ui/api/javascript/ui/scheduler#events-resizeEnd)

Thanks,
Grant

0
Veselin Tsvetanov
Telerik team
answered on 23 Oct 2017, 07:15 AM
Hi Grant,

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.

Regards,
Veselin Tsvetanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Tyler
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or