Skip to main content

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>
Attachments (0)
Change History (4)

Changed July 04, 2010 10:39PM UTC by Holger comment:1

Changed July 16, 2010 07:06PM UTC by scottgonzalez comment:2

milestone: TBD1.9
resolution: → fixed
status: newclosed

Fixed in 9d01ab5.

Changed August 04, 2010 01:32AM UTC by scottgonzalez comment:3

milestone: 1.91.8.3

Changed November 19, 2010 06:26PM UTC by Holger Rüprich comment:4

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