I want to disable TableSorter plugin on some th. These th have class="disableSorter", so I do:
$('.disableSorter').each(function(index) {
$('.tablesorter').tablesorter({ headers: { index: { sorter: false} } });
});
where index: is the index variable passed in the function. The thing is " index " is not replaced by the number (for example 0:, 1: 5:, etc.)
Thanks for help!
===== Edit =====
Thanks JaredPar, your solution was right about the dynamic variable. I had to edit the code because I wan't getting the index of the th element, but the index of the each loop.
Here's my final code
var inner = {};
$('.disableSorter').each(function() {
inner[$('.tablesorter th').index(this)] = { sorter: false };
});
$('.tablesorter').tablesorter({ headers: inner });