views:

1886

answers:

2

I am using the jQuery tableSorter plugin on a page.

Unfortunatley, the table that is being sorted is dynamically modified, and when I sort after adding an element, the element disappears, restoring the table to the state that it was in when the tableSorter was created.

Is there any way that i can force tableSorter to rescan the page so that these new elements are sorted properly?

+2  A: 

I believe you can trigger an update using something like:

$(table).trigger("update")
Josh
+1  A: 

Seems you are correct.

$(table).trigger("update");
$(table).trigger("appendCache");

does the trick.

As a note, the tablesorter API changed at some point, so these things got changed, as well as the event binding. My biggest hangup was trying to figure out why some things worked and others did not, and it was due to having a wrong version of the plugin, despite there being no obvious distinction.

Alex