I'm using jQuery's tablesorter plugin to sort my gridview on the client side. But here is the problem, i have to make that sorting option available to only one column. (column number is 7 in gridview)
$("#<%=gvResults.ClientID%>").tablesorter();
How can we make it possible with table sorter plug-in. Any suggestions please
If you know the column index that will have sorting enabled, then set the headers
option as follows:
$(function(){
$('table').tablesorter({
headers : {
// zero-based column index
0 : { sorter: false },
1 : { sorter: false },
2 : { sorter: false },
3 : { sorter: false },
4 : { sorter: false },
5 : { sorter: false }
}
});
});
The above code works on both the original tablesorter and my fork of tablesorter.
If you happen to be using my fork of tablesorter, then you can add class names to the headers:
<th class="sorter-false">column 1</th>
<th class="sorter-false">column 2</th>
<th class="sorter-false">column 3</th>
<!-- etc -->
<th>column 7</th>
and then initialize tablesorter without any extra options:
$(function(){
$('table').tablesorter();
});