MINOR if the $fieldname to DOS->sort has a direction in it, split it out, and pass it. (from r96482)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98140 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-02-04 03:50:45 +00:00
parent f212585325
commit 366e7a7fcc

View File

@ -817,6 +817,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);
}
}