Add support for order next to the column to DataView::getSortRules()
refs #8716
This commit is contained in:
parent
949438d753
commit
7ddd8d7ad2
|
@ -242,6 +242,7 @@ abstract class DataView implements Browsable, Countable, Filterable, Sortable
|
||||||
$order = (strtoupper($order) === static::SORT_ASC) ? 'ASC' : 'DESC';
|
$order = (strtoupper($order) === static::SORT_ASC) ? 'ASC' : 'DESC';
|
||||||
|
|
||||||
foreach ($sortColumns['columns'] as $column) {
|
foreach ($sortColumns['columns'] as $column) {
|
||||||
|
list($column, $direction) = $this->query->splitOrder($column);
|
||||||
if (! $this->isValidFilterTarget($column)) {
|
if (! $this->isValidFilterTarget($column)) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
mt('monitoring', 'The sort column "%s" is not allowed in "%s".'),
|
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)
|
get_class($this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->query->order($column, $order);
|
$this->query->order($column, $direction !== null ? $direction : $order);
|
||||||
}
|
}
|
||||||
$this->isSorted = true;
|
$this->isSorted = true;
|
||||||
return $this;
|
return $this;
|
||||||
|
|
Loading…
Reference in New Issue