JQuery UI sortable: restore position based on some condition
Posted
by dafi
on Stack Overflow
See other posts from Stack Overflow
or by dafi
Published on 2010-04-18T07:49:13Z
Indexed on
2010/04/18
7:53 UTC
Read the original article
Hit count: 415
jquery-ui
|jquery-ui-sortable
I call sortable.stop() to make an ajax call to store some data after drag&drop operation.
When the ajax call returns an error (application logic error or net problem) I want to move the dragged element to its original/start position, how can I achieve it?
The scenario should be
- user drags A to B
- the sortable.stop() event is called, it triggers an ajax call
- the ajax call returns an error
- inside the stop() event we get the ajax error
- move A to its original position
- user again move A to B
- everything is ok
- A remains in its new position in B
Steps 6-8 are shown to clarify a successive drag can be done and previous error must be forgotten
© Stack Overflow or respective owner