从表中删除jQuery tablesorter

psy*_*ott 12 jquery tablesorter unbind

我正在使用jQuery tablesorter(http://tablesorter.com).

在应用于表格之后$('#myTable').tablesorter(),如何从表格中再次删除它?

Mot*_*tie 27

没有内置函数来执行此操作,但您可以删除类名称和事件绑定以停止其运行...尝试这样的事情:

$('table')
 .unbind('appendCache applyWidgetId applyWidgets sorton update updateCell')
 .removeClass('tablesorter')
 .find('thead th')
 .unbind('click mousedown')
 .removeClass('header headerSortDown headerSortUp');
Run Code Online (Sandbox Code Playgroud)

如果您正在运行寻呼机插件,则上述操作无效.


小智 17

tablesorter2.0

$("#table").trigger("destroy");
Run Code Online (Sandbox Code Playgroud)

或者如果你只是需要在追加新的thead之后更新所有内容:

$("#table").trigger("updateAll");
Run Code Online (Sandbox Code Playgroud)

- > http://mottie.github.io/tablesorter/docs/index.html


San*_*eev 6

最新版本的表分拣库提供了Destroy方法

从版本2.16开始,在表分类器库中添加了destroy()方法,使用此方法从表中删除tablesorter.