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
精彩评论