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

Validate dragging and dropping a Kendo schedule event

4 Answers 68 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 12 Nov 2018, 03:41 AM

Hello,

I'm trying to implement some server validation when a user tries to move a schedule entry to an invalid resource.

I have tried validating on moveEnd event, however the e.event data contains the "from" data, but I want validate based on the "to" data.

I have tried validating on the save event. e.preventDefault() appears to work on the surface (i.e. the event does not move), however, it does something funny with the underlying data. A subsequent update to the scheduler refreshes scheduler showing the 'invalid' move.

Here's an example of what I mean:

https://dojo.telerik.com/@antman/aniGupAP

Steps:

1. Move "1. Move this to the left causing a conflict with "My Meeting"" as directed.

    

4 Answers, 1 is accepted

Sort by
0
Anthony
Top achievements
Rank 1
answered on 12 Nov 2018, 03:44 AM

...sorry, clicked post too early.

1a. e.preventDefault() is called on save. The event appears to not be moved.

2. Move "2. Move this somewhere with no conflict" down half an hour.

You will see the first event we moved now move to the position we tried to prevent.

Any advice on how this should be implemented would be appreciated. Thanks.

0
Anthony
Top achievements
Rank 1
answered on 12 Nov 2018, 03:46 AM

... oops posted early by accident.

1a. the save event calls e.preventDefault() and the event appears to not be moved.

2. Move "2. Move this somewhere with no conflict" event down half an hour so as to not cause a conflict.

You will see the first event move to the spot it tried to prevent.

Any advice on how to implement this kind of validation would be greatly appreciated. Thanks.

0
Accepted
Bozhidar
Telerik team
answered on 13 Nov 2018, 11:00 AM
Hi,

The moveEnd event contains information about the target slot. You can see this in action in the following demo:
https://demos.telerik.com/kendo-ui/scheduler/restriction

The fields available in the event arguments are detailed here:
https://docs.telerik.com/kendo-ui/api/javascript/ui/scheduler/events/moveend

Both e.start and e.end are the dates of the new position. The old position could be retrieved through the event instance.

Hope this was able to clear things up.

Regards,
Bozhidar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Anthony
Top achievements
Rank 1
answered on 14 Nov 2018, 11:59 PM

Thank you, Bozhidar.

I was able to get the data I needed to validate from the 'event.resources' object in the moveEnd event.

Tags
Scheduler
Asked by
Anthony
Top achievements
Rank 1
Answers by
Anthony
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or