public function actions() { return ArrayHelper::merge(parent::actions(), ['toggle' => ['class' => ToggleAction::className(), 'modelClass' => OptionsList::className(), 'setFlash' => true, 'attribute' => 'active', 'primaryKey' => 'id'], 'editsort' => ['class' => EditableColumnAction::className(), 'modelClass' => OptionsList::className(), 'outputValue' => function ($model, $attribute, $key, $index) { return (int) $model->{$attribute}; // return any custom output value if desired }, 'outputMessage' => function ($model, $attribute, $key, $index) { return ''; // any custom error to return after model save }, 'showModelErrors' => true, 'errorOptions' => ['header' => ''], 'postOnly' => true, 'ajaxOnly' => true]]); }
public function actions() { return ArrayHelper::merge(parent::actions(), ['update' => ['class' => EditableColumnAction::className(), 'modelClass' => Language::className(), 'findModel' => function ($id, $action) { $language = Language::findOne($id); $language->scenario = 'update'; return $language; }, 'outputValue' => function ($model, $attribute, $key, $index) { return $model->{$attribute}; }, 'outputMessage' => function ($model, $attribute, $key, $index) { return ''; }, 'showModelErrors' => true, 'errorOptions' => ['header' => '']]]); }