How can I sort my data with plugin Tablesorter
? I update my table with new data every "n" milliseconds.
My code:
$(document).ready(function() {
setInterval(foo, 10000);
foo();
function foo () {$('#tda').load('# #tt');}
$("#tt").tablesorter({
widgets: ["zebra"],
sortList:[[2,0]]
});
});
My page structure is:
<div id="tda">
<table id="tt">
<thead>
</thead>
<tbody>updated data...<tbody>
</table>
</div>
But this data is not sorted.
Tablesorter should be called within the load callback function:
$(function() {
setInterval(foo, 10000);
foo();
function foo () {
$('#tda').load("mysite.php", function() {
$("#tt").tablesorter({
widgets: ["zebra"],
sortList:[[2,0]]
});
});
});