Tablesorter (currently v2.0.5) includes an "update" method. This method keeps a Tablesorter object up to date with dynamic changes made to its table(s).
Like other Tablesorter methods "update" is implemented in the form of a custom event.
A typical method call would be $table.trigger("update"); , where $table is a jQuery object.
For some reason unknown to me, the "update" event code is written inside a setTimeout(function(){...}, 1) structure. Presumably this overcomes a problem in some browser or other.
This works fine within itself but means that statement(s) immediately following a .trigger("update") call will be executed before the "update". This is no good when the following statement(s) depend on the update being complete, notably .trigger("sorton", ...) , which (re)implements a sort.
The following patch overcomes the shortcoming by implementing within the "update" method:
- a way to re-execute the last user-selected sort
- a generalised way to execute any code of your choice.
For usage instructions, see comment block in code.
Airshow