Determine if Drag and Drop is valid after postback.

4 posts, 0 answers
  1. Kamal
    Kamal avatar
    4 posts
    Member since:
    Jun 2017

    Posted 19 Dec 2017 Link to this post

    Hello everyone, 

     

    I am making a post-back as part of the drop event. I would like value of e.valid to be set whether the post-back was successful. The issue I run into is that since $.post(..) is an asynchronous call, the Treelist will determine whether the move is valid with the current value of e.valid before the data is returned from the post.

     

    Is there a way to determine whether to complete the drop from the result of the post-back?

     

    Thank You in advance

    Kamal Singh

  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1064 posts

    Posted 21 Dec 2017 Link to this post

    Hi,

    Can you please elaborate on what exactly are you trying to achieve? If you can share with us the exact requirement for the TreeList and its use-case we should be able to provide a straight to the point suggestion.

    Regards,
    Angel Petrov
    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.
  3. Kamal
    Kamal avatar
    4 posts
    Member since:
    Jun 2017

    Posted 21 Dec 2017 in reply to Angel Petrov Link to this post

    Sure,

    So when a user drags an item and drops it under another parent, it will then make a callback to update the record in the database with the updated parentId. In the case that the save was not successful for some reason, I am trying to prevent the drag and drop, or reverse it, so the user is aware the drop didn't update the data. I will also display an error message letting the user know it was not successful. 

    Since the callback is asynchronous, the event that changes the grid seems to happen before the callback returns.

    A possible solution I am thinking about is maybe refreshing the entire tree list with the current state of the database if the save fails.

     

  4. Angel Petrov
    Admin
    Angel Petrov avatar
    1064 posts

    Posted 22 Dec 2017 Link to this post

    Hello,

    Thank you for clarifying.

    Indeed I would also recommend showing a message to the user that the update has failed and refreshing the treelist. The option to hold the item to wait for a response seems like a bad UX decision. 

    Regards,
    Angel Petrov
    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.
Back to Top