Updating jQuery Tablesorter plugin after removing

2019-01-07 18:25发布

I have some code at the moment that hides a row that is deleted and then removes it using the .remove() function.

However I'm having difficulty is making it remain "deleted" as every time I refresh the table sorted pager plugin or the filter plugin addon I'm using.. the deleted rows re-appear as they are of course cached.

Current code just simple with widget update at the moment

$('.deleteMAP').live("click", function(){
  $(this).closest('tr').css('fast', function() {
 $(this).remove();
 $(".tablesorter").trigger("update");
 $(".tablesorter").trigger("applyWidgets");
  });
})

Is there anyway to remove the "row" from both the cache of the pager plugin and also the tablesorter plugin so that when I "update" the table to reflect the fact a row has been removed they don't re-appear back from the dead via the cache!

7条回答
萌系小妹纸
2楼-- · 2019-01-07 19:03

This seems an odd approach, but actually it worked for me. Table renders fine and pager works properly.

$("#tabeBodyId").empty();
$("#tableId colgroup").remove();

//Update table(done using Ajax)
$("#tableId").tablesorter({widthFixed: true}).tablesorterPager({container: $("#pager")}); 
查看更多
登录 后发表回答