[Resolved] How to sort the gridview on a [POST] form without losing the filters using arrayDataProvider

I have a form with 14 search fields and half of these fields are arrays, so the form method is POST otherwise there is an error (414 - Request URI too long).
I’m using gridview to render results with pagination = 10, however when I click to show the results of the second tab of the gridview Yii2 can not interpret the request and all results are lost. I noticed that gridview uses the default GET method so it gets lost and “disappears” with the results.
The same happens when I try to use gridview sorting.

You might be able to make the query string short enough by overriding formName() of your search model.

Otherwise probably you have to store the posted query parameters as a session variable and merge it with a query parameters of GET method.

1 Like

Hi Softark.
I want to thank you very much for the great help.
The first solution to use formName () worked!
See you.

1 Like