dimanche 19 août 2018

How to display checkbox instead of bool variable in yii2 gridview?

I want to show some rows in yii2 gridview. one of column's type is BIT in mysql table. now I want to display checkbox(checked for 1, unchecked for 0) instead of thier values. for this reason I wrote follow codes:

  $widget = Yii::createObject([
                'class' => 'yii\grid\GridView',
                'dataProvider' => $dataprovider,
                'columns' => [
                    'PersonName',
                    'PersonType',
                    'order',
                    [
                     'value' => 'correspondingAuthorFlag',
                     'class' => 'yii\grid\CheckboxColumn',
                    ],
                ],

            ]
        );

but it throws an error. how can I do it?




Aucun commentaire:

Enregistrer un commentaire