Cannot change order direction of fixed order column
Cannot change order direction of fixed order column
Jamaur
Posts: 87Questions: 10Answers: 0
The order direction doesn't change, when a user clicks on a column heading that has a fixed order. Although the classes seem to change from sorting_asc to sorting_desc.
A test case showing this issue is shown in the link below: http://live.datatables.net/zerihiju/1/edit (Try clicking the column heading Position)
This discussion has been closed.
Replies
"orderFixed" means what it says.
From the docs:
I know what the docs says. Still, why do the classes change. It seems it was intended that the user can change the order direction when clicking the column heading but the sort will not be removed, if clicking on another column heading.
If not, this behaviour should be highly considered as a new option.
The classes changed because the sorting has changed. As the documentation says, the
orderFixed
is applied before the user sort, and then the user sort after that. So it effectively becomes a multi-column sort. Hence why multiple columns show sorting class information.If you just want to specify an initial sort order that will be removed when the end user selected a different column to sort on just use
order
.Allan
Thanks for replying.
Though I don't think we are on the same line. I am talking about having to the change just the sort direction (Asc or Desc) of a fixed order column. (All in the same column)
The classes changed but no sorting has happened, as you can see in the test case above. (Position Column)
That is not possible. The fixed ordering is fixed. There is no option to change it at this time.
That the classes change is a bug (updated text case which visually shows this). Thanks for letting me know about that.
Allan
Thanks for understanding. Still, it could be interesting to let the user change the sort direction. (even as a separate option) Thanks again.
For that you would just disable sorting on the other columns and allow normal sorting on the one you want to be "fixed". I don't plan to alter the fixed ordering to not be fixed :-).
Allan
Allan, another question.
Can I reset the orderFixed options?
An example. I have a table with n row gropuing. I want the user can sort the other columns but inside the row grouping order (not of the whole table). Besides users can change columns groupped: the table change and the row grouping order so.
At this time I need to change the orderFixed. How can I do it?
Thanks
Sorry no - there is no API to modify the fixed sorting at this time.
Allan
Thanks! Now, there is the API
https://datatables.net/reference/api/order.fixed()