From e9cd8ac145c33e0c1354b470fc2b7364d8d1db32 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Fri, 20 Sep 2013 16:20:27 +0200 Subject: [PATCH] // Search tree toolbar button --- classes/helper/HelperTreeCategories.php | 44 ++++++++++++++----------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/classes/helper/HelperTreeCategories.php b/classes/helper/HelperTreeCategories.php index b919ee3ca..c28344209 100644 --- a/classes/helper/HelperTreeCategories.php +++ b/classes/helper/HelperTreeCategories.php @@ -202,18 +202,29 @@ class HelperTreeCategoriesCore extends TreeCore && !empty($this->_disabled_categories)) $this->_disableCategories($data, $this->getDisabledCategories()); - $this->setActions(array( - new TreeToolbarLink( - 'Collapse All', - '#', - '$(\'#'.$this->getId().'\').tree(\'collapseAll\')', - 'icon-collapse-alt'), - new TreeToolbarLink( - 'Expand All', - '#', - '$(\'#'.$this->getId().'\').tree(\'expandAll\')', - 'icon-expand-alt') - )); + //Default bootstrap style of search is push-right, so we add this button first + if ($this->useSearch()) + { + $this->addAction(new TreeToolbarSearchCategories( + 'Find a category:', + $this->getId().'-categories-search') + ); + $this->setAttribute('use_search', $this->useSearch()); + } + + $this->addAction(new TreeToolbarLink( + 'Collapse All', + '#', + '$(\'#'.$this->getId().'\').tree(\'collapseAll\')', + 'icon-collapse-alt') + ); + + $this->addAction(new TreeToolbarLink( + 'Expand All', + '#', + '$(\'#'.$this->getId().'\').tree(\'expandAll\')', + 'icon-expand-alt') + ); if ($this->useCheckBox()) { @@ -235,14 +246,7 @@ class HelperTreeCategoriesCore extends TreeCore $this->setAttribute('use_checkbox', $this->useCheckBox()); } - if ($this->useSearch()) - { - $this->addAction(new TreeToolbarSearchCategories( - 'Find a category:', - $this->getId().'-categories-search') - ); - $this->setAttribute('use_search', $this->useSearch()); - } + $this->setAttribute('selected_categories', $this->getSelectedCatgories()); return parent::render($data);