开发者

jQuery tablesort and .empty() on ajax loaded table keeping rows

开发者 https://www.devze.com 2023-01-15 09:51 出处:网络
I am building a table with ajax and then attaching a jQuery tablesorter (found here). This works fine the first time. On a second time (and every one really) I empty out the rows like t开发者_运维知识

I am building a table with ajax and then attaching a jQuery tablesorter (found here). This works fine the first time. On a second time (and every one really) I empty out the rows like t开发者_运维知识库his:

$('#tblTableName tbody tr').empty();

I then add the rows as I did before and then reattach the tablesorter. It looks fine and I show only the rows that I just added. HOWEVER, if I sort the table it shows the rows that were emptied out (albeit sorted, <sarcasm>YAY! </sarcasm>) . I suspect that tablesorter needs to be cleared out as well, but I'm not seeing where to do that.


USE

$("#YOUR TABLE ID").trigger("update");

after adding new rows

0

精彩评论

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