From d3cfda5fe1bdb29fe10fe37132476aa0579e778c Mon Sep 17 00:00:00 2001 From: Matthias Schelling Date: Fri, 18 Nov 2016 19:13:54 +0100 Subject: [PATCH] Use Sort of GridField Header (#96) When not in 'Drag&Drop reordering' mode ('sortableToggle' is false) and a SortColumn is set by GridField's header, this last one should be used; otherwise, when the user clicks on a sortable header, the list is reloaded and the header shows a up/down sorting arrow, but this doesn't reflect the actual sorting. --- code/forms/GridFieldSortableRows.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/forms/GridFieldSortableRows.php b/code/forms/GridFieldSortableRows.php index 5981169..0ff55d9 100644 --- a/code/forms/GridFieldSortableRows.php +++ b/code/forms/GridFieldSortableRows.php @@ -119,7 +119,7 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP $headerState = $gridField->State->GridFieldSortableHeader; $state = $gridField->State->GridFieldSortableRows; if ((!is_bool($state->sortableToggle) || $state->sortableToggle==false) && $headerState && !empty($headerState->SortColumn)) { - return $dataList->sort($this->sortColumn); + return $dataList->sort($headerState->SortColumn); } if ($state->sortableToggle == true) { @@ -676,4 +676,4 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP } } } -?> \ No newline at end of file +?>