I am using the jquery tablesorter plugin. I start off by having a table with values and then I initialise my table like so..
$("#myStoreStatusTbl").tablesorter({
sortList: [[3,1],[10,0],[0,0]],
stripingRowClass: ['even','odd'],
stripeRowsOnStartUp: true,
widthFixed: false,
widgets: ['zebra'],
dateFormat: "uk",
headers: {
0: { sorter: 'digit' },
2: { sorter: false },
7: { sorter: false }
}
});
I later wipe out the contents of a table after an ajax call...
$('#myStoreStatusTbl tbody').html('');
And then re-populate it with values after an ajax call.
The re-populate is working but all the properties I have applied in the tablesorter init are no longer applied.
I tried to trigger an update after the ajax call...
$("#myStoreStatusTbl").trigger("update");
But that does not work. Can someone please give me some advice on this?
thanks
Can you please try following sequence after the ajax call:
$("#myStoreStatusTbl").trigger("update");
var sorting = [[3,1],[10,0],[0,0]];
// sort on the list
$("#myStoreStatusTbl").trigger("sorton",[sorting]);
This will execute sorton
event on newly populated data