Exemple #1
0
 /**
  * Sort grid columns
  */
 public function columnsortAction()
 {
     $id = Request::post('id', 'string', false);
     $newParent = Request::post('newparent', 'string', false);
     if (!strlen($newParent)) {
         $newParent = 0;
     }
     $order = Request::post('order', 'array', array());
     if (!$id || !$this->_object->columnExists($id)) {
         Response::jsonError($this->_lang->WRONG_REQUEST . ' code1');
     }
     $this->_object->changeParent($id, $newParent);
     $count = 0;
     foreach ($order as $name) {
         if (!$this->_object->setItemOrder($name, $count)) {
             Response::jsonError($this->_lang->WRONG_REQUEST . ' code2');
         }
         $count++;
     }
     $this->_object->reindexColumns();
     $this->_storeProject();
     Response::jsonSuccess();
 }