From 99be47c479245e80162bfdd99c435ebf803bee55 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 13 Apr 2010 02:17:25 +0000 Subject: [PATCH] MINOR if the $fieldname to DOS->sort has a direction in it, split it out, and pass it. (from r96482) (from r98140) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102612 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/DataObjectSet.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/model/DataObjectSet.php b/core/model/DataObjectSet.php index 7d0d239ec..eacf426b2 100644 --- a/core/model/DataObjectSet.php +++ b/core/model/DataObjectSet.php @@ -850,6 +850,10 @@ class DataObjectSet extends ViewableData implements IteratorAggregate, Countable */ public function sort($fieldname, $direction = "ASC") { if($this->items) { + if (preg_match('/(.+?)(\s+?)(A|DE)SC$/', $fieldname, $matches)) { + $fieldname = $matches[1]; + $direction = $matches[3].'SC'; + } column_sort($this->items, $fieldname, $direction, false); } }