grid\CheckboxColumn $checkboxOptions

$checkboxOptions public property

The HTML attributes for checkboxes. This can either be an array of attributes or an anonymous function (Closure) that returns such an array. The signature of the function should be the following: function ($model, $key, $index, $column). Where $model, $key, and $index refer to the model, key and index of the row currently being rendered and $column is a reference to the yii\grid\CheckboxColumn object. A function may be used to assign different attributes to different rows based on the data in that row. Specifically if you want to set a different value for the checkbox you can use this option in the following way (in this example using the name attribute of the model):

'checkboxOptions' => function ($model, $key, $index, $column) {
    return ['value' => $model->name];
}

See also yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.

doc_Yii
2016-10-30 17:04:01
Comments
Leave a Comment

Please login to continue.