In \yii\grid\Column::filter what's the minimum required code?

\yii\grid\gridview creates an input field for filtering if \yi\grid\Column::filter is not set. If I were to manually create the input field with said property, what would be the required code. As what I’m trying

'filter'=> '<input type="text" name="OrderSearch[number]" class="form-control">',

isn’t working properly. Since is not showing validation errors (.error-class is not being added on validation error, etc). Does filter though.

Your OrderSearch model has validation rules defined?

You’d have to trigger its “validate” method and then maybe an active input field as filter would show validation errors:

Hi, no luck.


                'attribute' => 'number',

                //'filter'=> '<input type="text" name="OrderSearch[number]" class="form-control">',

                'filter' => html::activeInput('text', $searchModel, 'number'),

                'format' => 'raw',

                'value' => function($model) {

                    //return sprintf('%08d', $model->number);

                    return Html::a(sprintf('%08d', $model->number), ['customer/orders', 'id'=>$model->customer->id, 'highlight'=>$model->id]);


It IS validating, It IS filtering, but IS NOT showing model errors when applicable.

When you look at the OrderSearch in the view, does it have errors?

Yes It does. Accorging to Xdebug it is at


I don’t know what the value is since It “can not get property” but I guess that’s not relevant.

Does anyone know whether this is the expected behaviour?

Does it work with the standard input field, if you do not set "filter"?

If so, have a look at the html and compare it to what’s generated in your case - might give you an idea.

This is a bug