mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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
This commit is contained in:
parent
864a15db8e
commit
99be47c479
@ -850,6 +850,10 @@ class DataObjectSet extends ViewableData implements IteratorAggregate, Countable
|
|||||||
*/
|
*/
|
||||||
public function sort($fieldname, $direction = "ASC") {
|
public function sort($fieldname, $direction = "ASC") {
|
||||||
if($this->items) {
|
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);
|
column_sort($this->items, $fieldname, $direction, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user