jgg jgg - 2 years ago 99
jQuery Question

JQuery table sorting; problem with dynamically added rows

I am using a jquery tablesorter plugin(http://tablesorter.com/docs/) for sorting my tables. This works for rows that created already. But when I add a row dynamically with Jquery clone() method, sorting is not working.

What I should I do to sort rows even if I add a row dynamically?

Answer Source

$('.tablesorter').trigger('update'); after you add a row.

Tablesorter only scans through the table once, and after that it sorts on internally stored numeric or text values. It's quite clever, actually, as it makes the act of sorting super quick.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download