Example #1
0
 /**
  * Add actions column to the grid with base controls (edit or editform, delete)
  *
  * @return void
  */
 public function addActionsColumn()
 {
     $options = $this->grid->getConfig();
     $numCustom = count($this->grid->getRowActionButtons());
     $width = 60 + $numCustom * 15;
     $this->grid->addColumn('Actions', array('name' => 'myac', 'width' => $width, 'fixed' => true, 'sortable' => false, 'resizable' => false, 'formatter' => $numCustom ? new Expr($this->getActionFunctioName()) : 'actions', 'search' => false, 'classes' => 'action-column', 'viewable' => false, 'editable' => false, 'editrules' => array('edithidden' => false), 'formatoptions' => array('keys' => false, 'editbutton' => $options['nav_grid']['edit'], 'editformbutton' => $this->grid->getAllowEditForm(), 'delbutton' => $options['nav_grid']['del'], 'delOptions' => array('afterSubmit' => new Expr("function(response, postdata) {\n                                                    var json = eval('(' + response.responseText + ')');\n                                                    return [json.success, json.message];\n                                               }                                              ")), 'editOptions' => $options['edit_parameters'], 'onError' => new Expr("function(rowid,response) {\n                                                                    var json = eval('(' + response.responseText + ')');\n                                                                   alert('Error saving row: ' + json.message);\n                                                                   jQuery('#" . $this->grid->getGridId() . "').restoreAfterError = false;\n                                                                         return true;\n                                                                   }\n                                                                   "))));
 }