Add support for order next to the column to DataView::getSortRules()

refs #8716
This commit is contained in:
Eric Lippmann 2015-03-13 17:12:16 +01:00
parent 949438d753
commit 7ddd8d7ad2
1 changed files with 2 additions and 1 deletions

View File

@ -242,6 +242,7 @@ abstract class DataView implements Browsable, Countable, Filterable, Sortable
$order = (strtoupper($order) === static::SORT_ASC) ? 'ASC' : 'DESC';
foreach ($sortColumns['columns'] as $column) {
list($column, $direction) = $this->query->splitOrder($column);
if (! $this->isValidFilterTarget($column)) {
throw new QueryException(
mt('monitoring', 'The sort column "%s" is not allowed in "%s".'),
@ -249,7 +250,7 @@ abstract class DataView implements Browsable, Countable, Filterable, Sortable
get_class($this)
);
}
$this->query->order($column, $order);
$this->query->order($column, $direction !== null ? $direction : $order);
}
$this->isSorted = true;
return $this;