Skip to main content

Search and Top Navigation

#7524 closed bug (notabug)

Opened July 02, 2011 08:50PM UTC

Closed July 08, 2011 01:33AM UTC

Last modified July 09, 2011 12:36AM UTC

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:

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.

Attachments (0)
Change History (6)

Changed July 07, 2011 12:52PM UTC by scottgonzalez comment:1

owner: → eric8166
status: newpending

Are you using a cloned helper for the draggable?

Changed July 08, 2011 01:26AM UTC by eric8166 comment:2

status: pendingnew

Yes I am.

Changed July 08, 2011 01:33AM UTC by scottgonzalez comment:3

resolution: → invalid
status: newclosed

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

Changed July 08, 2011 08:59AM UTC by eric8166 comment:4

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

Changed July 08, 2011 09:51AM UTC by scottgonzalez comment:5

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.

Changed July 09, 2011 12:36AM UTC by eric8166 comment:6

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.