GridView, show special row

Need Help. Yii2.

There is PRODUCT table, which contain also STATUS field.

In the View page need to show 3 gridview, One with STATUS = 1, Second for STATUS=2, and third for STATUS = 3. I know, that create 3 dataProviders (3 queries) is wrong.

What is the best solution??

You can have one gridView witch dropmenu (in column status) to change filter data.




...

[

    'attribute'=>'status',

    'filter'=>array("status"=> 1,"status"=> 2 ,"status"=> 3),

],

...



or

Thank you for your reply. Simply need 3 panels with gridview. Not with dropdown filter

Is it mandatory you have to show three grid together or if not?.pceuropa answer is good.

If it is mandatory then no option you have place three grid.

What U could do is to adjust search method to accept $status, and addCondition ‘t.status’ => $status. That will allow U to make 3 different grids in view file that can be populated trough one search by sending different $status for each of them

1 Like