Scenario:
* Have a table view with multiple columns
* All headers are click-sortable
* No default for click-sort headers
* Have multiple sort criteria, including some of the same fields as click-sortable headers
Options:
(1): "Override normal sorting if click sorting is used" disabled
(2): " Override normal sorting if click sorting is used" enabled
Expected behavior:
* Clicking a header will change sort precedence
* AND additional sort criteria will still be applied
* AND sort criteria in conflict with click-sort headers will be discarded
Observed behavior (1):
* Clicking a header takes precedence for sorting
* All sort criteria discarded completely
Observed behavior (2):
* Clicking a header does not impact sort precedence
* Clicking a header only changes sort order (ASC/DESC)
Example:
Events Listing
Headers: Company / Topic / Year
Sort criteria (before clicking table headers): Year (DESC), Company, Topic
If I click "Company", I expect the following ORDER BY to be applied:
Company, Year (DESC), Topic
Instead, what I see is:
option 1: Company
option 2: Year (DESC), Company, Topic
Comment | File | Size | Author |
---|---|---|---|
#10 | Views-sort-criteria-3059961-10.patch | 664 bytes | mdolnik |
Comments
Comment #10
mdolnik CreditAttribution: mdolnik commentedThis patch modifies
\Drupal\views\Plugin\views\style\Table::buildSortPost()
to add existing sort filters after the click-sort has been processed.This will ensure that either value of
Override normal sorting if click sorting is used
will keep existing sort filters, but the checking will ensure the click-sort is sorted first, while un-checking will ensure the click-sort is sorted last.Comment #11
smustgrave CreditAttribution: smustgrave at Mobomo commentedIS should be updated to include proposed solution
As a bug will need a test case showing the problem.
Thanks.