orderData: v2.1.0 breaks prev approach for sort indications on visible col ordered by hidden col
orderData: v2.1.0 breaks prev approach for sort indications on visible col ordered by hidden col
This is a follow-up to a previous thread: https://datatables.net/forums/discussion/79061
Example linked from that thread at https://datatables.net/forums/discussion/78954
In this scenario, column X is ordered by column Y and column Y is not visible. The approach discussed in the linked thread is to set the classes on the column header for column X based on the classes retrieved from the header for column Y.
After updating to v2.1.0, the approach covered in that previous thread no longer works. In testing and debugging, it appears that under v2.1.0 the not-visible column used to sort the visible column is no longer receiving the classes for ordering as it did in v2.0.x.
Is there an alternative approach to ensure the visible column's header can get the classes needed to visually show ordering?
We rely on the "sort by a hidden column" for a wide variety of semantic or logical sorting situations (e.g., process status) where alphabetic or numeric sorting doesn't make sense.
This question has an accepted answers - jump to answer
Answers
There's probably a more official method for working out the class somewhere but this works:
https://live.datatables.net/jikunori/16
I'll need to check this. I did make a change in this area, but the intention had been to limit to the
aria-sort
attribute only. I guess I wasn't specific enough. I'll dig into it and post back with findings.Allan
I've committed a fix here and will be releasing 2.1.1 with the changes in the next day or two. (Edit - it will actually be v2.1.2 - I'd forgotten that many years ago I inadvertently added a 2.1.1 tag! That will need to be skipped now).
I've added a test specifically for this situation, so it will be this way here on in
Allan
Thanks, @allan, as always! I'll watch for the 2.1.2 release, test, and follow up here.