diff --git a/src/GridFieldOrderableRows.php b/src/GridFieldOrderableRows.php index 6b3d8bb..e5da805 100755 --- a/src/GridFieldOrderableRows.php +++ b/src/GridFieldOrderableRows.php @@ -365,6 +365,17 @@ public function getManipulatedData(GridField $grid, SS_List $list) if ($list instanceof DataList) { $classname = $list->dataClass(); if ($defaultSort = Config::inst()->get($classname, 'default_sort')) { + $defaultSortTerm = ''; + + // Check to see if `default_sort` is an array + if (is_array($defaultSort)) { + foreach ($defaultSort as $col => $dir) { + $defaultSortTerm .= "$col $dir, "; + } + } else { + $defaultSortTerm = $defaultSort; + } + // Append the default sort to the end of the sort string // This may result in redundancy... but it seems to work $sortterm .= ($sortterm ? ', ' : '') . $defaultSort;