Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#7524 closed bug (notabug)

draggables on sortable fails .sortable('serialize')

Reported by: eric8166 Owned by: eric8166
Priority: minor Milestone: 1.9.0
Component: ui.sortable Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:

Description

The fix for the ticket 4564, since version 8.1.13, introduces a major problem. If an item is moved from a draggable into a sortable, and its receipt is processed using .sortable('serialize'), the serialized list will contain an empty string where the item's id should be. Is there a workaround ?

Also please see comment 8 on ticket 4564.

Change History (6)

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

Owner: set to eric8166
Status: newpending

Are you using a cloned helper for the draggable?

comment:2 Changed 12 years ago by eric8166

Status: pendingnew

Yes I am.

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

Resolution: invalid
Status: newclosed

As mentioned in the other ticket, what you want to do is invalid.

comment:4 Changed 12 years ago by eric8166

In the application I created, users (school teachers), are building a menu structure by assembling different options. Those options are dragged from a set of available items, and more than one can be added to their structure. So how are we supposed to find out what items were added to a sortable list? I was under the impression that the ('serialize') is the function to use to find out what was added. But I also understand that an item ID should be unique in DOM. So I also tried to set the ATTR("ID",xxx) of the created object in the receive: event, but it seems to fail.

$('#TDSorterBARS1').sortable({receive: function(event, ui) {ui.item.attr("id", SomeUniqueID );}});

Could you please confirm that failure to setting the ID in the receive event is a bug then ?

Thanks, Eric

comment:5 Changed 12 years ago by Scott González

ui.item refers to the original item, not the helper that you're trying to change. For some reason there doesn't seem to be a way to get the element you want. My suggestion would be to use a custom helper instead of the simple clone. The API will become much more sane in jQuery UI 2.0.

comment:6 Changed 12 years ago by eric8166

Thanks, but I can not wait till 2.0, since 1.9 is not even out. I checked your source code change, and could see the .removeAttr("id") but could not find any .addClass.

So when I try to search like $(".IDOfOriginalDraggable") it does not find the new element.

Note: See TracTickets for help on using tickets.