Opened 11 years ago

Closed 9 years ago

#8980 closed bug (duplicate)

Draggable: Error when removing item inside sortreceive callback

Reported by: mrpaulbarrett Owned by: mrpaulbarrett
Priority: minor Milestone: none
Component: ui.draggable Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:


Setting up two sets of sortable Tabs, so that the tabs can be dragged and dropped between windows.

On the first occurrence of a drag and drop, the tab and its associated div are correctly moved but inspecting in Firebug I get:

TypeError: $(...).data(...) is undefined
var o = $(this).data('draggable').options; (jquery-ui-1.9.2.js line 2186)

Trying to move the same tab back to the original Tabs set does not work, the tab <li> is not accepted, however the drop method within droppable is triggered. Dragged tabs do not lose sortable behaviour.

It looks like the draggable options are not transferred to the helper clone during the drag operation. I consider this to be a bug.

I have set up a JSFiddle at which demonstrates this problem. Drag any tab to the other tab set, then try and drag it back.

I am using jquery 1.9 and jquery ui 1.9.2

Change History (8)

comment:1 Changed 11 years ago by Scott González

Owner: set to mrpaulbarrett
Status: newpending

Why are you making tabs draggable and sortable? It's really hard to tell what you're trying to accomplish by doing that. This looks like a bug with a combination of draggable + cursor + sortable + removing elements. Would you mind putting together a test case that doesn't include tabs? The less code the better. Thanks.

comment:2 Changed 11 years ago by mrpaulbarrett

Status: pendingnew

I'm doing this so that I can have multiple tabs where any two can be visible side-by-side, independent of where they are initially placed. Say I have tabs 1,2,3,4 and 5,6,7,8 and would like to see 6 and 7 side by side. That's what I'm trying to achieve. i don't think that's unreasonable.

I will try and assemble a test case as described.

comment:3 Changed 11 years ago by Scott González

My question is why are they draggable and not just sortable? I'm just curious.

comment:4 Changed 11 years ago by mrpaulbarrett

Sortable on it's own would mean that i am limited to 1,2,3,4 on the left and 5,6,7,8 on the right. The user might want 6 and 7 to be viewed simultaneously, so drags 6 over to the left then to move back so that 1 and 6 can be viewed together. Draggable/Droppable is the only way to accomplish this, since sortables are limited to the scope of their container. The main aim of this is so that I do not have multiple instances of elements within the tabs.

comment:6 Changed 11 years ago by mrpaulbarrett

A simplified test case here, with tabs not involved:

You can drag one item from one list to the other, it is accepted, is still sortable, but then dragging that item back to the original list makes it disappear, i.e. not accepted. Expected behaviour should be that the list items should be draggable and droppable between lists as connectWith is based on a class selector (not ID as demonstrated in the connectWith docs).

comment:7 Changed 11 years ago by Scott González

Status: newopen
Summary: Sortable tab cloning cannot access data('draggable')Draggable: Error when removing item inside sortreceive callback

Thanks. Here's a fully reduced test case:

comment:8 Changed 9 years ago by mikesherov

Resolution: duplicate
Status: openclosed

Duplicate of #6889.
This was fixed a while ago by d345a0d7db841a143dcfdd3fb6fa6141cda435e9

Note: See TracTickets for help on using tickets.