开发者

jQuery tablesorter disable last header

开发者 https://www.devze.com 2023-03-28 00:03 出处:网络
I am using tablesorter for my tables, and now I want that always the last header is disabled from sorting.

I am using tablesorter for my tables, and now I want that always the last header is disabled from sorting.

I have tried this:

 $(".so开发者_StackOverflow社区rter")
 .tablesorter({widgets: ['zebra'], headers:{0:{sorter:false}, -1:{sorter:false}}})          
 .tablesorterPager({container: $("#pager"), positionFixed: false, size : 5 });

But that does not work... does someone know a solution?


It is not a valid config to specify -1, try this

var $sorterTable = $(".sorter");

var tablesorterConfig = { widgets: ['zebra'], headers:{ 0:{sorter:false} } };

tablesorterConfig.headers[$sorterTable.find("thead th").length - 1] = { sorter:false };


$sorterTable
.tablesorter(tablesorterConfig)          
.tablesorterPager({container: $("#pager"), positionFixed: false, size : 5 });
0

精彩评论

暂无评论...
验证码 换一张
取 消