Can I reverse the sort icons?
Can I reverse the sort icons?
I have a column (Age) that sorts on a hidden column (Created Date). Since one column is the inverse of the other, when sorted the displayed values are opposite the arrow (up means descending). Is there a way to reverse the arrows for this column?
Note that I know how to solve this programmatically and don't need a workaround. I could add a second hidden column (I need to keep the hidden Created Date column for another column's sorting) to store the age as a number as opposed to text (the reason I need the hidden column in the first place). I'm hoping there's a simpler solution that doesn't require loading up more data into the table. Thanks!
Note that I know how to solve this programmatically and don't need a workaround. I could add a second hidden column (I need to keep the hidden Created Date column for another column's sorting) to store the age as a number as opposed to text (the reason I need the hidden column in the first place). I'm hoping there's a simpler solution that doesn't require loading up more data into the table. Thanks!
This discussion has been closed.
Replies
Allan
* On the I added a class.
[code]
Age
[/code]
* In my CSS I added two selectors to reverse the icons used.
[code]
th[class~=reverse].sorting_asc {
background:transparent url(images/sort_desc.png) no-repeat scroll right center;
}
th[class~=reverse].sorting_desc {
background:transparent url(images/sort_asc.png) no-repeat scroll right center;
}
[/code]
That's certainly easy enough to do. I still think adding a new
[code]
'bReverseSortIcons': boolean
[/code]
parameter to aoColumns to do the above automatically would be handy. Maybe even
[code]
'bReverseSort': boolean
[/code]
as shorthand for
[code]
'asSorting': ['desc', 'asc']
[/code]
but I also understand the value of a slim API. :)
Thanks for the details. As you note, I think for the sake of keeping the API as basic as possible, I'm inclined not to add a new parameter such as bReverseSort which would effectively be doing the same thing as asSorting. I can see the advantage of it, since it increases accessibility of this particular option, and if it comes up as a request a few more times I might look at adding it. However, for the moment I'll leave it as it is. Hopefully anyone who wants to do this reserve sorting will have enough knowledge to use asSorting as well :-)
Regards,
Allan