$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) : ''; }, ],
Please login to continue.