开发者

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开发者_JAVA百科 a row dynamically?


$('.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.


The plugin has an example of an ajax update and it looks like you just have to trigger an "update" method on the table after you add your dynamic data.

Look here: http://tablesorter.com/docs/example-ajax.html

Code:

// let the plugin know that we made a update 
$("table").trigger("update"); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜