A
A
agent11562017-01-25 19:02:25
Yii
agent1156, 2017-01-25 19:02:25

How to change filter value in gridview from 1 to 'YES'?

conclusion_top is 0.1

['attribute' => 'conclusion_top',
                'filter'=> \yii\helpers\ArrayHelper::map(\backend\models\Alaniatape::find()->all(),'conclusion_top', 'conclusion_top'),
                'value' => function ($data) {
                    return $data->conclusion_top ? '<span class="text-success"><i class="glyphicon glyphicon-ok"></i></span>' : '<span class="text-danger"><i class=" glyphicon glyphicon-remove"></i></span>';
                },
                'format' => 'raw'],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-01-25
@webinar

You should have in the filter what is in
If you need yes and no, then you should probably do this:

[
'attribute' => 'conclusion_top',
'filter'=> [0=>'нет', 1=>'да']
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question