I'm using Yii2 and I want to add a checkbox filter for a boolean variables in a GridView search. This is my rules from ModelSearch:
public function rules()
{
return [
[['bool1','bool2','bool3','bool4'],'boolean']
];
}
So, how can I render as a checkbox instead of text input?
These are my GridView parameters:
$paramsCustom = [
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
['class' => 'yii\grid\CheckboxColumn'],
[
//boolean column
'attribute' => 'bool1',
'label' => 'S',
'format' => 'raw',
'value' => function ($model, $index, $widget) {
....
},
],
My bool1 attribute is boolean. So, in the GridView filtering appears a text input, and I want to filter the results displayed in the GridView using a checkbox instead a text input.
This is my GridView column:
