Icinga\Web\Controller::setupSortControl(): set query on the newly created SortBox (if given)

refs #9220
This commit is contained in:
Alexander A. Klimov 2015-05-11 16:28:23 +02:00
parent 32659647b9
commit e1c3d23d12

View File

@ -43,17 +43,22 @@ class Controller extends ModuleActionController
* *
* @param array $columns An array containing the sort columns, with the * @param array $columns An array containing the sort columns, with the
* submit value as the key and the label as the value * submit value as the key and the label as the value
* @param Sortable $query Query to set on the newly created SortBox
* *
* @return $this * @return $this
*/ */
protected function setupSortControl(array $columns) protected function setupSortControl(array $columns, Sortable $query = null)
{ {
if (! $this->view->compact) { if (! $this->view->compact) {
$req = $this->getRequest(); $req = $this->getRequest();
$this->view->sortBox = SortBox::create( $this->view->sortBox = $sortBox = SortBox::create(
'sortbox-' . $req->getActionName(), 'sortbox-' . $req->getActionName(),
$columns $columns
)->setRequest($req); )->setRequest($req);
if ($query !== null) {
$sortBox->setQuery($query);
}
$sortBox->handleRequest();
} }
return $this; return $this;