yii\grid\ActionColumn::initDefaultButtons PHP Method

initDefaultButtons() protected method

Initializes the default button rendering callbacks.
protected initDefaultButtons ( )
    protected function initDefaultButtons()
    {
        $this->initDefaultButton('view', 'eye-open');
        $this->initDefaultButton('update', 'pencil');
        $this->initDefaultButton('delete', 'trash', ['data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post']);
    }

Usage Example

Example #1
0
 /**
  * Initializes the default button rendering callbacks.
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if (!isset($this->buttons['active'])) {
         $this->buttons['active'] = function ($url, $model) {
             return Html::a('<span onclick="admin_api.request({id:' . $model['id'] . ', model:\'' . lcfirst((new \ReflectionClass($model))->getShortName()) . '\', method:\'post\', attributes:{active:' . ($model['active'] ? '0' : '1') . '}})" class="glyphicon ' . ($model['active'] ? 'glyphicon-ok' : 'glyphicon-ban-circle') . ' " style="color: ' . ($model['active'] ? 'yellow' : 'gray') . ' "></span>', '', ['title' => $model['active'] ? 'Отключить' : 'Включить']);
         };
     }
 }
All Usage Examples Of yii\grid\ActionColumn::initDefaultButtons