jquery tablesorter - mouseover column headings
-
18-09-2019 - |
Question
is there a way to have the mouseover with a hand when you go over the column heading so its clear that you can click on the column heading to sort the table by that column
Solution
Yes, this is achievable using the cursor: pointer CSS property. It is possible to apply this property in the CSS file within the appropriate class, or directly with jQuery:
$('th').css('cursor', 'pointer');
OTHER TIPS
$('th').css('cursor', 'pointer');
The advantage to applying this rule in JavaScript is the style will not apply if JavaScript is disabled (meaning the columns will not be sortable).
Alternatively, you could have your "sort-enabling" code apply a class to the parent table
of the headings, reducing the number of DOM operations required and further separating behaviour and presentation.
$('table').makeSortable().addClass('sortable');
...
.sortable th {
cursor: pointer;
}