Answer the question
In order to leave comments, you need to log in
Checkbox + label in Gridview how to display?
Hello, this code:
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'class' => 'yii\grid\CheckboxColumn',
'checkboxOptions' => function ($model, $key, $index, $column) {
return ['checked' => $model->published];
}
],
...
<input type="checkbox" name="selection[]" value="120" checked="">
<label>
<input type="checkbox" name="selection[]" value="120" checked="">
</label>
Answer the question
In order to leave comments, you need to log in
use the content
property , like so:
[
'class' => 'yii\grid\CheckboxColumn',
'content' => function ($model, $key, $index, $column) {
$checkbox = // генерируем какой-угодно чекбокс
return $checkbox;
}
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question