Grid component: How to reset pagination when filter changes?

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?

Hello Fractalize…

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

Thank!!

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