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.

CommentFileSizeAuthor
#3 2905428-3.patch598 bytesjoelpittet
#2 2905428-2.patch595 bytesdmachev
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dmachev created an issue. See original summary.

dmachev’s picture

FileSize
595 bytes

Patch added.

joelpittet’s picture

Status: Active » Needs review
FileSize
598 bytes

Minor 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

dqd’s picture

Status: Needs review » Postponed (maintainer needs more info)

Sorry 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?