views:

173

answers:

2

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

+1  A: 

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');

chriswattsuk
`cursor: pointer` is more standard.
Alex Barrett
A: 
$('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;
}
Alex Barrett