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

@ -41,19 +41,24 @@ class Controller extends ModuleActionController
* *
* In case the current view has been requested as compact this method does nothing. * In case the current view has been requested as compact this method does nothing.
* *
* @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;