From e4932315568cd95f1d8d944fc32bd4b09e59ee63 Mon Sep 17 00:00:00 2001 From: James Cocker Date: Wed, 6 Aug 2014 16:34:25 +0100 Subject: [PATCH] Fixes fixSortColumn's Random Inital Sorting When loading a GridField with several new items without a sort order (e.g. after uploading 10 images via GridFieldBulkEditingTools), it would previously apply a seemingly random order to them. This fix ensures that the order applied is the same order as the items were created (or uploaded) in. --- code/forms/GridFieldSortableRows.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/forms/GridFieldSortableRows.php b/code/forms/GridFieldSortableRows.php index 4e75245..6f67ea4 100644 --- a/code/forms/GridFieldSortableRows.php +++ b/code/forms/GridFieldSortableRows.php @@ -153,7 +153,7 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP $max = $list->Max($this->sortColumn); - $list=$list->filter($this->sortColumn, 0); + $list=$list->filter($this->sortColumn, 0)->sort("Created,ID"); if($list->Count()>0) { $owner = $gridField->Form->getRecord(); $sortColumn = $this->sortColumn;