A follow-up to parent issue #2429213: Default sort order not applied
Problem/Motivation
Seems that an intuitive approach to re-ordering a table when a column header is clicked would be to apply first the default order set for the specific column, i.e. in case the default order is set to 'descending', clicking on its header should first sort it in descending order. Currently ordering applied in this manner always sorts the table in ascending order first.
Proposed resolution
Setting attribute 'orderSequence' to ['desc', 'asc'] for columns where the values of attribute options['info'][$field]['default_sort_order'] = 'desc'
, as done in the attached patch.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2905428-3.patch | 598 bytes | joelpittet |
Comments
Comment #2
dmachev CreditAttribution: dmachev at The University of British Columbia commentedPatch added.
Comment #3
joelpittetMinor update to the patch. Short array syntax only works for PHP >= 5.4.
And this patch is actually on top of #2293243: Broken with DataTables API Change in v1.10.0
https://www.datatables.net/upgrade/1.10-convert
So I tried to put the equivalent and will merge this into the patch over there.
Here's the docs for the current version showing this should still work with 'asSorting'.
http://legacy.datatables.net/usage/columns
Comment #4
dqdSorry that I missed this one! Thanks for all the hard work in here. @joelpittet is this issue still relevant and useful for later versions? Should we tag it for a reroll?