Search and Top Navigation
#5229 closed bug (worksforme)
Opened February 25, 2010 06:10AM UTC
Closed February 26, 2010 02:22AM UTC
Last modified October 11, 2012 09:15PM UTC
.sortable( 'cancel' ) cancels whole item drag
Reported by: | Chealer | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | ui.sortable | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
.sortable( 'cancel' ) is supposed to behave like this:
Signature:
.sortable( 'cancel' )
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.
If the sortable item is not being moved from one connected sortable to another:
$(this).sortable('cancel');
will cancel the change.
If the sortable item is being moved from one connected sortable to another:
$(ui.sender).sortable('cancel');
will cancel the change. Useful in the 'receive' callback.
The first line works as expected, but the second doesn't. If two sortables A and B are connected and one wants to keep B's content constant, he could use cancel on B so that a drag between A and B would only affect A. But this doesn't work. If for example A's receive event handler has $(ui.sender).sortable('cancel'); and an item is dragged from B to A, both A and B are unchanged. The item is not added to A.
The change is cancelled. Canceling the sort is the same as the sort never occurring. If you need help implementing what you expected, please ask on the forum.