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

Determine if Drag and Drop is valid after postback.

3 Answers 72 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Kamal
Top achievements
Rank 1
Kamal asked on 19 Dec 2017, 08:08 PM

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

3 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 21 Dec 2017, 11:37 AM
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.
0
Kamal
Top achievements
Rank 1
answered on 21 Dec 2017, 07:32 PM

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.

 

0
Angel Petrov
Telerik team
answered on 22 Dec 2017, 01:05 PM
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.
Tags
TreeList
Asked by
Kamal
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Kamal
Top achievements
Rank 1
Share this question
or