From e00596e818ac5aea2e94cb376b2b2006e8b8da88 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 11 May 2018 16:07:28 +0100 Subject: [PATCH] FIX Work with ManyManyThroughList --- src/GridFieldOrderableRows.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GridFieldOrderableRows.php b/src/GridFieldOrderableRows.php index 83b34ce..9a1558e 100755 --- a/src/GridFieldOrderableRows.php +++ b/src/GridFieldOrderableRows.php @@ -19,6 +19,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DB; use SilverStripe\ORM\ManyManyList; +use SilverStripe\ORM\ManyManyThroughList; use SilverStripe\ORM\Map; use SilverStripe\ORM\SS_List; use SilverStripe\ORM\FieldType\DBDatetime; @@ -183,7 +184,7 @@ class GridFieldOrderableRows extends RequestHandler implements { $field = $this->getSortField(); - if ($list instanceof ManyManyList) { + if ($list instanceof ManyManyList || $list instanceof ManyManyThroughList) { $extra = $list->getExtraFields(); if ($extra && array_key_exists($field, $extra)) { @@ -211,7 +212,7 @@ class GridFieldOrderableRows extends RequestHandler implements public function getSortTable(SS_List $list) { $field = $this->getSortField(); - if ($list instanceof ManyManyList) { + if ($list instanceof ManyManyList || $list instanceof ManyManyThroughList) { $extra = $list->getExtraFields(); $table = $list->getJoinTable(); if ($extra && array_key_exists($field, $extra)) {