从DOM中删除一行后更新jQuery Tablesorter插件 [英] Updating jQuery Tablesorter plugin after removing a row from DOM

查看:131
本文介绍了从DOM中删除一行后更新jQuery Tablesorter插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此刻我有一些代码可以隐藏要删除的行,然后使用.remove()函数将其删除.

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");
  });
})

无论如何,有没有要从分页器插件的缓存和tablesorter插件的缓存中删除行",以便当我更新"表以反映已删除行的事实时,它们不会重新出现通过缓存从死里复生!

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!

推荐答案

我找到了适合我的解决方案:

I found a solution that worked for me:

var usersTable = $(".tablesorter");
usersTable.trigger("update")
  .trigger("sorton", [usersTable.get(0).config.sortList])
  .trigger("appendCache")
  .trigger("applyWidgets");

将其放在您编辑表格的位置之后.

Put this after the place where you've edited the table.

这篇关于从DOM中删除一行后更新jQuery Tablesorter插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆