H
H
hollanditkzn2017-03-16 12:27:02
Yii
hollanditkzn, 2017-03-16 12:27:02

How to make a dropdown list appear in the grid table filter?

I know how to implement it, but I don’t understand how to implement it in yii2, I tried everything in sql, it outputs data normally, here is the sql code that I should get

SELECT otdel.id, otdel.fio FROM `zakaz` JOIN otdel WHERE zakaz.id_sotrud = otdel.id

And how do i implement in yii2
in grid table
[
                'attribute' => 'id_sotrud',
                'value' => 'idSotrud.fio',
                'filter' => Zakaz::getSotrudList()
            ],

And in the file frontend/models/Zakaz
public static function getSotrudList()
    {
        $sotruds = Zakaz::find()
        ->select(['otdel.id','otdel.fio'])
        ->join('JOIN','otdel', 'zakaz.id_sotrud = otdel.id')
        ->all();
    }

But in the end it is not possible to display the list and the data gets null

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Derepko, 2017-03-16
@hollanditkzn

https://nix-tips.ru/yii2-razbiraemsya-s-gridview.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question