4

I'm 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 I'm 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?

1
  • damn.. i've tried everything -.- Commented Oct 13, 2010 at 15:29

1 Answer 1

3

Got it working.

It should be:

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

(of course..) thanks anyway :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.