views:

40

answers:

1

Im using jQuery UI sortable on a table.

My javascript:

    $("#linksSortable tbody").sortable({
    handle  : '.handle', 
    //helper    : fixHelper,
    update  : function () { 
      var order = $('#linksSortable').sortable('serialize'); 
      //$("#info").load("ajaxtest.php?"+order); 
      alert(order);
    }
});

My table:

<table id="linksSortable">
    <tbody>
        <tr id="listItem_1"><td>1969</td><td>Slaughterhouse-Five</td><td>A+</td></tr>
        <tr id="listItem_2"><td>1952</td><td>Player Piano</td><td>B</td></tr>
        <tr id="listItem_3"><td>1963</td><td>Cat's Cradle</td><td>A+</td></tr>
        <tr id="listItem_4"><td>1973</td><td>Breakfast of Champions</td><td>C</td></tr>
        <tr id="listItem_5"><td>1965</td><td>God Bless You, Mr. Rosewater</td><td>A</td></tr>
    </tbody>
</table>

The sorting is working great, but when i want to get the order using the serialize function im getting this error in firebug:

uncaught exception: cannot call methods on sortable prior to initialization; attempted to call method 'serialize'

What am i doing wrong? - Thanks in advance.

A: 

Got it working.

It should be:

var order = $('#linksSortable tbody').sortable('serialize'); 

(of course..) thanks anyway :)

s0mmer