grid\ActionColumn $buttons

$buttons public property

Button rendering callbacks. The array keys are the button names (without curly brackets), and the values are the corresponding button rendering callbacks. The callbacks should use the following signature:

function ($url, $model, $key) {
    // return the button HTML code
}

where $url is the URL that the column creates for the button, $model is the model object being rendered for the current row, and $key is the key of the model in the data provider array.

You can add further conditions to the button, for example only display it, when the model is editable (here assuming you have a status field that indicates that):

[
    'update' => function ($url, $model, $key) {
        return $model->status === 'editable' ? Html::a('Update', $url) : '';
    },
],
public array $buttons = []
doc_Yii
2016-10-30 17:03:58
Comments
Leave a Comment

Please login to continue.