Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#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
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>

Change History (4)

comment:2 Changed 13 years ago by Scott González

Milestone: TBD1.9
Resolution: fixed
Status: newclosed

Fixed in 9d01ab5.

comment:3 Changed 13 years ago by Scott González

Milestone: 1.91.8.3

comment:4 Changed 12 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.