After making changes to the table, use this instead:

$('#myTable').trigger("update"); // rebuilds the tablesorter data cache

If you have added rows and need to resort, try either this:

$("#myTable").trigger("sorton",[sorting]); // where [sorting] is the JS 
array of the sorting column info (see docs)

or:
var sorting = $("#myTable")[0].config.sortList;  // grabs the current 
tablesorter sorting configuration
$("#myTable").trigger("sorton",[sorting]);  // resorts using the current 
tablesorter configuration

HTH,
Carl

A13thGuest wrote:
> The tablesorter is acting goofy and I'm wondering if anyone has any
> insight to the problem or a way to fix it.
>
> I'm adding rows to a table then calling tablesorter:
>
> $('#myTable').tablesorter();
>
> Works fine.
>
> If I clear rows from the table then add more rows, I call tablesorter
> again:
> $('#myTable').tablesorter();
>
> When I try to sort, records that were previously removed pop into my
> table again.
>
> There doesn't seem to be a way to clear the tablesorter before
> reloading it with the new table results. For example:
> $('#myTable').tablesorter('destroy');
> $('#myTable').tablesorter();
>
> Any suggestions?
> Thanks in advance.
>
>
>   

Reply via email to