Validate dragging and dropping a Kendo schedule event

5 posts, 1 answers
  1. Anthony
    Anthony avatar
    5 posts
    Member since:
    May 2018

    Posted 11 Nov 2018 Link to this post

    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.

        

  2. Anthony
    Anthony avatar
    5 posts
    Member since:
    May 2018

    Posted 11 Nov 2018 in reply to Anthony Link to this post

    ...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.

  3. Anthony
    Anthony avatar
    5 posts
    Member since:
    May 2018

    Posted 11 Nov 2018 in reply to Anthony Link to this post

    ... 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.

  4. Answer
    Bozhidar
    Admin
    Bozhidar avatar
    1190 posts

    Posted 13 Nov 2018 Link to this post

    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.
  5. Anthony
    Anthony avatar
    5 posts
    Member since:
    May 2018

    Posted 14 Nov 2018 in reply to Bozhidar Link to this post

    Thank you, Bozhidar.

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

Back to Top