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

Was it helpful?

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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top