Opened 15 years ago
Closed 15 years ago
#4043 closed bug (notabug)
sortable("serialize", {attribute: "anything"}) returns no value
Reported by: | ajacksified | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 1.7 |
Component: | ui.sortable | Version: | 1.6rc6 |
Keywords: | sortable, serialize, toArray | Cc: | |
Blocked by: | Blocking: |
Description
The "serialize" argument does not work when specifying an attribute; nothing is returned. The same code with "toArray" returns the expected result.
<ul id="sortableList" class="sortableList"> <li id="Li1" itemid='1'> ... </li> <li id="Li2" itemid='2'> ... </li> <li id="Li3" itemid='3'> ... </li> </ul> <script type="text/javascript"> $(".sortableList").sortable({ scroll: true, axis: "y", containment: "parent", handle: $("div.sortableListTitleText").add("div.handle.move"), update: function(){ var newList = $(".sortableList").sortable( "serialize", {attribute: "itemid"}); } }); </script>
newList is empty; however, using var newList = $(".sortableList").sortable( "toArray", {attribute: "itemid"}); returns an array of 'itemid' values.
Change History (4)
comment:1 Changed 15 years ago by
Priority: | major → critical |
---|
comment:2 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 15 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:4 Changed 15 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Note: See
TracTickets for help on using
tickets.
That's not a bug. the value must be something like 'name_1' or 'name-1' in order to match the default expression that will then construct a query string like name[]=1&name[]=2. What you probably want is to use the 'key' option and set it to 'itemid' as well:
sortable('serialize', {
})
This should do the job for you.