Force ordering when list widget column is sorted

When ordering is applied externally, ie. by a relation config, the orderBy call in the List widget simply adds an additional field to the ordering clauses, which prevents lists in these scenarios from being re-ordered correctly. This changes the order clause so that the ordering is reset and only the specified column is ordered when the user sorts a column.

Developers can continue to use the `extendQuery` event to do specialised custom ordering if required.

Fixes #4439.
This commit is contained in:
Ben Thomson 2019-12-02 09:27:25 +08:00
parent 1283121069
commit 9f8d8ec9fa
No known key found for this signature in database
GPG Key ID: B2BAFACC5ED68F87
1 changed files with 1 additions and 0 deletions

View File

@ -532,6 +532,7 @@ class Lists extends WidgetBase
$sortColumn = $column->relation . '_count';
}
$query->getQuery()->orders = [];
$query->orderBy($sortColumn, $this->sortDirection);
}