Illegal string offset 'class' - get this after adding widget to Yii2 gridview

Hi,

Having a small issue adding the datecontrol widget to a gridview.

EDIT: this is the dateControl wiget from Kartik:

kartik-v/yii2-datecontrol

Here is my code in the index file:


`GridView::widget([

'dataProvider' => $dataProvider,

'filterModel' => $searchModel,

'columns' => [

['class' => 'yii\grid\SerialColumn'],


        //'id',

        'entryNumber',

        'categoryId',

        //'accountId',

        'description',

        'amount',

        //'account.description',

         //'displayEntryDate',

         //'entryDate',

        [

            'attribute' => 'entryDate',

            'value' => 'entryDate',

            'filter' => DateControl::widget(DateControl::classname(), ['type'=>DateControl::FORMAT_DATE,])

        ],

        ['class' => 'yii\grid\ActionColumn'],

    ],

]);`

When I run this I get the following error:

PHP Warning – yii\base\ErrorException

Illegal string offset ‘class’

The code should be something like the following:




'columns' => [

    ...

    [

        'attribute' => 'entryDate',

        'value' => 'entryDate',

        'filter' => DateControl::widget([

            'type'=>DateControl::FORMAT_DATE,

            'model' => $searchModel,

            'attribute' => 'entryDate',

        ])

    ],



OK!! Thank you! That works