Grid component: How to reset pagination when filter changes?

(Fractalizer) #1

I’m using \yii\grid\GridView widget to display data, that was fetched via API from external resource. I’ve created a data provider which just calls my API and returns data as array.

The problem is when you do some page navigation and then apply a filter which results in less pages, than your current search, you get an empty result set without any pagination at all and you can’t return to the first page.

As one of possible solutions, I would like to reset current page to zero whenever user changes filtering conditions. Is that possible? Or may be there is another way?

(Manuel Alejandro Gonzalez Prieto) #2

Hello Fractalize…

I have the same problem in an application, have you found a solution to yours?


(Manuel Alejandro Gonzalez Prieto) #3

‘filterUrl’ => Url::to([‘request/index’, ‘page’ => 1]),