D
D
Denis Popov2020-07-13 17:39:54
Yii
Denis Popov, 2020-07-13 17:39:54

How to add filter outside GridView?

Is it possible to somehow add a filter field to the GridView outside of the GridView? For example, select some over the table, so that it works as it should, the filters are summarized ...

I tried to add a link like

<a href="<?=Url::to([controller/action/],'MySearch[is_active]=>'0'?>')">Неактивные</a>

The filter is applied, everything is saved when navigating through the pages, but as soon as I drive it into the GridView in some field, for example, in the id field, my is_active stupidly disappears from the parameters of the final URL. Why is this happening?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2020-07-13
@DenisDangerous

Almost right, but not right. 'MySearch => [is_active =>'0' ]
And even better: The name will be substituted even when you change the name of the form.
$searchForm->getFormName() => [is_active =>'0' ]

<?=Url::to([controller/action/], $searchForm->getFormName() => [is_active =>'0' ])?>

D
di, 2020-07-13
@Delgus

https://github.com/yiisoft/yii2/blob/master/docs/g...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question