Search and Top Navigation
#8162 closed bug (duplicate)
Opened March 04, 2012 08:00PM UTC
Closed July 24, 2012 07:13PM UTC
sortable does not properly clean up
Reported by: | jjoemb | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.sortable | Version: | 1.8.18 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have a draggable, sortable, and droppable. When the sortable sorts within itself, the 'receive' event does not fire (as it shouldn't). However, if you drag an item from the draggable, through the sortable, then onto the droppable (with the net result of leaving the sortable unaffected), the sortable will fire 'receive' on the following sort, but not after that.
I've traced the code a bit, and it appears that the 'fromOutside' variable is set, even if the sortable had no net effect. When the next sort happens, it uses the previous value of 'fromOutside' to trigger the receive event. My only fix has been monkey patching; the sortable code is too complex for me to feel confident in fixing it.
Here is a fiddle that reproduces the problem: http://jsfiddle.net/GG8r8/1/
Attachments (0)
Change History (4)
Changed March 05, 2012 05:04PM UTC by comment:1
status: | new → open |
---|
Changed May 30, 2012 02:54PM UTC by comment:2
I've also hit this - it's when the draggable is using "connectToSortable" with the sortable in question and, as the original reporter says, when a draggable is dragged over the sortable but then dragged out again and dropped elsewhere (it doesn't have to be dropped onto a droppable, just dropping it anywhere outside that sortable will leave the sortable with fromOutside set).
The drag method in the "connectToSortable" bit is what sets fromOutside (just after a comment saying "hack so receive/update callbacks work (mostly)", as well as a chunk of other stuff, on the sortable if "this.instance._intersectsWith(this.instance.containerCache)" is true and if "!this.instance.isOver" is also true. If it doesn't intersect but isOver then it does some cleanup, but that cleanup is missing clearing fromOutside.
So I think is needed is after the line in the connectToSortable drag method which reads "inst.dropped = false; //draggable revert needs that" is to have a line reading "this.instance.fromOutside = false;" - see code fragment below:
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size this.instance.currentItem.remove(); if(this.instance.placeholder) this.instance.placeholder.remove(); inst._trigger("fromSortable", event); inst.dropped = false; //draggable revert needs that this.instance.fromOutside = false; }
I've tried out this one line fix with the case I was hitting, and it seems to work (the original receive event still fires when it should as well).
Changed July 24, 2012 07:05PM UTC by comment:3
I believe this is a dup of #8430 (well, really the other way around).
Changed July 24, 2012 07:13PM UTC by comment:4
resolution: | → duplicate |
---|---|
status: | open → closed |
See related (though not duplicate) ticket #4303