Best way to obtain a combobox filter [GridView]

Hi all,

that’s my first post, I’m glad to be here as a Yii user!

I have a question. I’m trying to accomplish a simple task: render, in the GridView, a boolean model field (is a tinyint in mysql) as a “Yes/No” field and the relative filter as a select tag.

You can see the result in the attached screenshot.

This is the code


        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        'columns' => [

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





		'attribute'=> 'own', 

		'filter' => [1=>Yii::t('app', 'Sì'), 0=>Yii::t('app', 'No')],

		'value' => function ($model, $key, $index, $column){

			return ($model['own']) ? Yii::t('app', 'Sì') : Yii::t('app', 'No');



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


First I tried to write "own:boolean" only and I obtained the Yes/No field on the table, but in the filter section there was an input text.

With the value function I obtained the final result.

Maybe it’s because I’m new to Yii, but it has not been easy to accomplish this task.

Is it the right way?

ps: also, it is possible to change the default empty option with a text like "all" or something similar?