Remove jQuery tablesorter from table

若如初见. 提交于 2019-11-28 01:50:43

There isn't a built-in function to do this, but you could remove the class names and event bindings to stop its functioning... try something like this:

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

The above won't work if you have the pager plugin running.

Volker Ahlers

tablesorter2.0

$("#table").trigger("destroy");

or if you just in need to update all after appending new thead :

$("#table").trigger("updateAll");

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

Latest version of table sorter library provides Destroy method

From version 2.16 destroy() method has been added in table sorter library, use this method to remove tablesorter from the table.

use the function given below onclick event of remove shorting element

function removeTableShorter(){
$("#myTable").tablesorter({ 
headers: {
 0: {sorter: false},
 1: {sorter: false},
 2: {sorter: false},
 3: {sorter: false},
 4: {sorter: false},
 5: {sorter: false}
}
});
$('#myTable th').removeAttr('class');}

u may increase the number of headers according the number of columns of table.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!