Barney
Barney

Reputation: 1848

Jquery UI Sortable

I'm confused about the JQuery UI sortable events handler. How can I make a function fire everytime there is a change e.g. $("#tablename tbody").sortable({ change: myfunction() });

Upvotes: 0

Views: 348

Answers (2)

Aleksandar Vucetic
Aleksandar Vucetic

Reputation: 14953

"change" event will be fired only if DOM position has changed. You can use sort event to catch any sorting if that is what you want.

Upvotes: 0

Snake Eyes
Snake Eyes

Reputation: 16754

in this way:

$( ".selector" ).sortable({
   change: function(event, ui) { 
      //code goes here
   }
});

or

$( ".selector" ).bind( "sortchange", function(event, ui) {
  //code goes here
});

Documentation: http://jqueryui.com/demos/sortable/#event-change

Upvotes: 1

Related Questions