Problem (jsFiddle demo of the problem)
I'm having some trouble with the revert
setting when used in conjunction with the cancel
method in the jQuery sortable. The cancel method, as documented in the jQuery Sortable documentation states:
Cancels a change in the current sortable and reverts it back to how it
was before the current sort started. Useful in the stop and receive
callback functions.
This works fine in both the stop
and receive
callbacks, however if I add a revert
duration to the sortable connected list, it starts to act funny (see jsFiddle here).
Ideally, upon cancelling, the revert
could simply not happen, or alternatively in a more ideal world, it would gracefully revert to it's original location. Any ideas how I can get the revert
and cancel
to play nice?
Expected
- Drag from left list to right list
- Drop item
- Item animates to original location - or - immediately shifts to original location
Actual
- Drag from left list to right list
- Drop item
- Item animates to new location, assuming sortable is successful
- Item immediately shifts to original location, as sortable was cancelled
Clarification
The revert
property moves the item to the location where the item would drop if successful, and then immediately shifts back to the original location due to the revert
occurring before the cancel
method. Is there a way to alter the life-cycle so if the cancel
method is executed, revert
isn't, and instead the item is immediately return to it's original location?