From 24f87ae10ebd97fe5f6ba4c2a87cf60d521f9861 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sun, 14 Jun 2020 14:29:21 -0600 Subject: [PATCH] Also remove custom sorts from relationcontroller lists / pivot manage modes. Fixes https://github.com/octobercms/october/issues/4335#issuecomment-643706004, refs: https://github.com/octobercms/october/commit/5f8a5454eeb401d5ac13b5b644353b8dcaf0de14 --- modules/backend/behaviors/RelationController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index dcbff39d4..f6c96382d 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -856,8 +856,11 @@ class RelationController extends ControllerBehavior }); } else { - $widget->bindEvent('list.extendQueryBefore', function ($query) { + $widget->bindEvent('list.extendQueryBefore', function ($query) use ($widget) { $this->relationObject->addDefinedConstraintsToQuery($query); + if ($widget->getSortColumn()) { + $query->getQuery()->orders = []; + } }); }