I’m using TableSorter and need to disable the sorting on some columns.
I can add options
In my case I need to add the column numbers 1 and 2 below, from a variable, like I did with my_number. 1 and 2 work but not my_number (which is set to 3).
$(document).ready(function() {
var my_number = 3;
$("table").tablesorter({
headers: {
1: {
sorter: false
},
2: {
sorter: false
},
my_number: {
sorter: false
},
}
});
});
@koskoz gave you the correct answer, so please give him credit. I wanted to show you the full example of how to use it:
And share an alternative with you. I’ve forked a copy of tablesorter which allows you to just add a class name to the header like
sorter-falseto disable sorting of that column. Check out this demo