You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are replacing the <tbody> content, the given example is perfect. However, if you want to dynamically replace the <thead> as well, you need to do something like this:
$('#mytable').trigger('destroy').html(' new thead and tbody ').tablesorter({...});
One more thing to note: Parsers will need to be re-applied, as 'destroy' destroys them as well.
Thanks Mottie for the amazing work!
The text was updated successfully, but these errors were encountered:
// Remove tablesorter and all classes// false in the destroy method means leave the "tablesorter" and "tablesorter-{theme}" class names alone$("table").trigger("destroy",[false,function(){// callback after the destroy method// modify the table here$('table thead').html('<tr>'+headers+'</tr>');$('table tbody').html(data);// reinitialize the plugin$("table").tablesorter(initOptions);}]);
*Note: You can't modify the thead before calling the destroy method because the destroy method will restore the headers to the way they were before the plugin was initialized (data is saved in table.config.headerContent)
This began as an issue, but I came up with a solution in the process of writing it down. Someone might find this useful in your "empty table" example http://mottie.github.com/tablesorter/docs/example-empty-table.html ...
If you are replacing the
<tbody>
content, the given example is perfect. However, if you want to dynamically replace the<thead>
as well, you need to do something like this:One more thing to note: Parsers will need to be re-applied, as 'destroy' destroys them as well.
Thanks Mottie for the amazing work!
The text was updated successfully, but these errors were encountered: