I have recently been experimenting with the tablesorter plugin for jQuery. I have successfully got it up and running in once instance, and am very impressed. However, I have tri
Once you have appended your data, do this:
$("your-table").trigger("update");
var sorting = [[0,0]];
$("your-table").trigger("sorton",[sorting]);
This will let the plugin know it has had an update, and re-sort it.
The complete example given in the doc:
$(document).ready(function() {
$("table").tablesorter();
$("#ajax-append").click(function() {
$.get("assets/ajax-content.html", function(html) {
// append the "ajax'd" data to the table body
$("table tbody").append(html);
// let the plugin know that we made a update
$("table").trigger("update");
// set sorting column and direction, this will sort on the first and third column
var sorting = [[2,1],[0,0]];
// sort on the first column
$("table").trigger("sorton",[sorting]);
});
return false;
});
});
From the tablesorter doc here: http://tablesorter.com/docs/example-ajax.html