Search and Top Navigation
#5794 closed enhancement (fixed)
Opened July 04, 2010 10:25PM UTC
Closed July 16, 2010 07:06PM UTC
Last modified November 19, 2010 06:26PM UTC
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 | |
| Blocked by: | Blocking: |
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>
Patch on github: http://github.com/holger/jquery-ui/commit/f1a7824791565c46c036df66503c6bdd9f802b90