function __construct($grid) { parent::__construct($grid); //Уберем сортировку по колонкам, она уже не нужна if ($this->disableSortable) { foreach ($grid->columns as $key => $column) { if (is_object($column)) { if (get_class($column) == 'CDataColumn') { $column->sortable = false; } } } } //CVarDumper::dump($this->grid->dataProvider->getSort()->orderBy,2,true); $this->template = '{moveup}{movedown}'; $imgPath = $this->publish(); $move = <<<EOD \t\tfunction() { \t\t\t\$.fn.yiiGridView.update('{$this->grid->id}', { \t\t\t\ttype:'POST', \t\t\t\turl:\$(this).attr('href'), \t\t\t\tsuccess:function() { \t\t\t\t\t\$.fn.yiiGridView.update('{$this->grid->id}'); \t\t\t\t} \t\t\t}); \t\t\treturn false; \t\t} EOD; $this->buttons = array('moveup' => array('label' => 'Вверх', 'url' => 'array("default/move", "method"=>"up", "id" => $data->id)', 'imageUrl' => $imgPath . '/up.png', 'options' => array('class' => 'moveup'), 'click' => $move), 'movedown' => array('label' => 'Вниз', 'url' => 'array("default/move", "method"=>"down", "id" => $data->id)', 'imageUrl' => $imgPath . '/down.png', 'options' => array('class' => 'movedown'), 'click' => $move)); }
/** * Constructor * * @param CGridView $grid */ function __construct($grid) { parent::__construct($grid); //Уберем сортировку по колонкам, она уже не нужна if ($this->disableSortable) { foreach ($grid->columns as $key => $column) { if (is_object($column)) { if (get_class($column) == 'CDataColumn') { $column->sortable = false; } } } } $jsClick = "\n\t\t\tfunction() {\n\t\t\t\t\$.fn.yiiGridView.update('{$this->grid->id}', {\n\t\t\t\t\ttype:'POST',\n\t\t\t\t\turl:\$(this).attr('href'),\n\t\t\t\t\tsuccess:function() {\n\t\t\t\t\t\t\$.fn.yiiGridView.update('{$this->grid->id}');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t"; $this->buttons = array('moveup' => array('label' => 'Вверх', 'options' => array('class' => 'moveup'), 'click' => $jsClick), 'movedown' => array('label' => 'Вниз', 'options' => array('class' => 'movedown'), 'click' => $jsClick)); }
function __construct($grid) { parent::__construct($grid); $this->buttons=array ( 'view' => array ( 'imageUrl'=>'/images/admin/view_grid.png', ), 'update' => array ( 'imageUrl'=>'/images/admin/edit.png', ), 'delete' => array ( 'imageUrl'=>'/images/admin/del.png', ), ); }