TableSorter works very well with Child rows - You simply need to give the child tr
a tablesorter-childRow
class and the parent tr
a tablesorter-hasChildRow
class, and table sorter is able to sort the table while ignoring all child rows...
However, when creating new children on the fly using Jquery, Tablesorter no longer ignores these newly created children...
When trying to sort the new table (i.e. after creating children), the newly created children are pushed to the top of the table and the rest of the table is sorted as normal.
This demonstrated by this JsFiddle: https://jsfiddle.net/szzp0aq9/1/
Is it possible to get TableSorter to ignore these newly generated child rows?
EDIT
Background: I initially had empty hidden child rows under each row that I would show()
when required...
However, as the table produced by my program can be quite large, sometimes with over 5000 rows, all these empty hidden rows increases the file size by quite a bit... Thus I was trying to see if I could create these rows only when required and still keep table sorter happy...
(btw, the html file produced by my program is only viewed on a local machine and not uploaded onto the internet)
When a new row is added, the tablesorter internal cache also needs to be updated. In order to do this, you'll need to trigger the "update" method (demo)