jQuery tablesorter disable last header
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 });
精彩评论