Ticket #5794 (closed enhancement: fixed)
sortable("serialize", {key: "foo[]"}) returns an empty string for an empty list
| Reported by: | Holger | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | 1.8.3 |
| Component: | ui.sortable | Version: | 1.8.2 |
| Keywords: | Cc: | Holger | |
| Blocking: | Blocked by: |
Description
The serialize method returns an empty String for empty lists when a custome key is defined. A form/ajax submittable string should rather be 'foo[]=' in the following example, if option_1 is moved to the connected list #bar:
<ul id="foo" class="sortable">
<li id="option_1">1</li>
</ul>
<ul id="bar" class="sortable">
<li id="option_2">2</li>
</ul>
<script type="text/javascript">
$(function(){
$('.sortable').sortable({
connectWith: '.sortable',
update: function (event, ui) {
console.log('Update: ' +
$(event.target).sortable('serialize', {
key: event.target.id + '[]'
})
);
}
});
});
</script>
Change History
comment:2 Changed 3 years ago by scott.gonzalez
- Status changed from new to closed
- Resolution set to fixed
- Milestone changed from TBD to 1.9
Fixed in 9d01ab5.
comment:4 Changed 3 years ago by Holger Rüprich
Sortable: Return an empty URL param for empty sortable lists. Fixed #5794 - sortable("serialize", {key: "foo[]"}) returns an empty string for an empty list
Changeset: 9d01ab564525f9112c2488ad257637593062b70d
Note: See
TracTickets for help on using
tickets.


Patch on github: http://github.com/holger/jquery-ui/commit/f1a7824791565c46c036df66503c6bdd9f802b90