/** * Apply sorting orders for actions (sort actions) */ public function sortActions() { $this->_actions->sortItems(); }
/** * Resort tree Items * @param mixed $parentId - optional, resort only item childs * default - false (resort all items) */ public function resortItems($parentId = false) { $this->_tree->sortItems($parentId); }
/** * Reindex columns (apply sort order) */ public function reindexColumns() { $this->_columns->sortItems(); }
public function test_sortChilds() { $tree = new Tree(); $tree->addItem('a', 0, 50, 1); $tree->addItem(1, 'a', 100, 1); $tree->addItem(2, 'a', 200, 2); $tree->addItem(3, 'a', 300, 3); $tree->setItemOrder(2, 4); $tree->sortItems('a'); $items = $tree->getChilds('a'); $newOrder = array(); foreach ($items as $v) { $newOrder[] = $v['data']; } $this->assertEquals($newOrder, array(100, 300, 200)); $tree = new Tree(); $tree->addItem(1, 0, 100, 1); $tree->addItem(2, 0, 200, 2); $tree->addItem(3, 0, 300, 3); $tree->setItemOrder(2, 4); $tree->sortItems(); $items = $tree->getChilds(0); $newOrder = array(); foreach ($items as $v) { $newOrder[] = $v['data']; } $this->assertEquals($newOrder, array(100, 300, 200)); }