lundi 26 février 2018

Implement bootstrap 4 checkboxes style in yii\grid\CheckboxColumn

I'm using bootstrap 4 and YII 2 and i want to customize my checkbox inputs like the next link

https://getbootstrap.com/docs/4.0/components/forms/#checkboxes.

So im usign the yii\grid\CheckboxColumn class, but I dont know how to do it.

I tried the fallowing

'columns' => [
            [
                'class' => 'yii\grid\CheckboxColumn',
                'cssClass' => 'checkbox-select',
                'headerOptions' => ['style' => 'width:5px'],
                'header' =>  '<div class="custom-control custom-checkbox">'.Html::checkBox('selection_all', false, ['id' => 'customCheck1', 'type' => 'checkbox', 'class' => 'custom-control-input select-on-check-all']).'<label class="custom-control-label" for="customCheck1"></label></div>',
                'checkboxOptions' => function($model){

                    return ['<div class="custom-control custom-checkbox">'.Html::checkBox('selection', false, ['id' => "'customCheck".$model->id."'", 'class' => 'custom-control-input']).'<label class="custom-control-label" for="customCheck'.$model->id.'"></label></div>'];

                },

            ],
           ],

It only works in the table header but not in the other checkboxes.

enter image description here




Aucun commentaire:

Enregistrer un commentaire