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


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

EDIT: this is the dateControl wiget from Kartik:


Here is my code in the index file:


'dataProvider' => $dataProvider,

'filterModel' => $searchModel,

'columns' => [

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











            '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([


            'model' => $searchModel,

            'attribute' => 'entryDate',



OK!! Thank you! That works