mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-22 13:24:24 +02:00
monitoring: Fix that sorting a data view is not possible if its sort
rules are empty
This commit is contained in:
parent
421263af00
commit
a9ae75b6b0
@ -204,9 +204,11 @@ public function dump()
|
||||
public function sort($column = null, $order = null)
|
||||
{
|
||||
$sortRules = $this->getSortRules();
|
||||
|
||||
if ($sortRules !== null) {
|
||||
if ($column === null) {
|
||||
// Use first available sort rule as default
|
||||
if (empty($sortRules)) {
|
||||
return $this;
|
||||
}
|
||||
$sortColumns = reset($sortRules);
|
||||
if (! isset($sortColumns['columns'])) {
|
||||
$sortColumns['columns'] = array(key($sortRules));
|
||||
@ -239,7 +241,6 @@ public function dump()
|
||||
$this->query->order($column, $order);
|
||||
}
|
||||
$this->isSorted = true;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -250,7 +251,7 @@ public function dump()
|
||||
*/
|
||||
public function getSortRules()
|
||||
{
|
||||
return null;
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -365,6 +366,9 @@ public function dump()
|
||||
*/
|
||||
public function paginate($itemsPerPage = null, $pageNumber = null)
|
||||
{
|
||||
if (! $this->isSorted) {
|
||||
$this->order();
|
||||
}
|
||||
return $this->query->paginate($itemsPerPage, $pageNumber);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user