#5055 closed bug (duplicate)
Sortable: cancel method does not work properly
Reported by: | jessicah | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.9.0 |
Component: | ui.sortable | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Have been unable to find a way to cancel sorting with a keypress.
E.g. I start sorting, then want to press Escape to cancel and revert to previous state.
My attempt inside the sort callback was to attach to the keydown handler and call $("#sortable").sortable('cancel'), but the state of the sortable was left inconsistent. The placeholder element didn't disappear, and the dragged item got left as is on the page.
In fact, the placeholder seemed to become part of the list, and the "orphaned" item was still draggable. Dragging the same or other item added a new placeholder.
Change History (4)
comment:1 Changed 13 years ago by
Milestone: | TBD → 1.8 |
---|---|
Priority: | minor → major |
Summary: | ui.sortable cancel sorting with a keypress → Sortable: cancel method does not work properly |
Type: | enhancement → bug |
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Closing as a duplicate of #5882 which I just landed a fix for. After this fix, the following code seems to works as expected:
$( document ).keydown(function( event ) { if ( event.keyCode === $.ui.keyCode.ESCAPE ) { $( "#sortable" ).sortable( "cancel" ); } }); $( "#sortable" ).sortable();
Having the same problem in 1.8.5. Hope it'll get fixed in 1.9.