Gridview into form, lose filter when change page

Hi all, I put my gridview into a form because i need to let the user select some rows and change their status.

In my controller i change
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider = $searchModel->search(Yii::$app->request->post());

It works fine and all the filter made by the user pass in post method.
But when i go to the next page i lose post parameters of the filter.
The pagination links use get method adding “page” and “per-page” parameter.

Can you suggest me how to solve it?

1 Like

At the moment i solve by myself in this way. I don’t know if there’s a better solution.
In my controller i save in the session the filter parameters and if ther’isn’t (when change page or sort the grid) i load from session:

    $post = Yii::$app->request->post();
    $params = ["ProductSearch"=>[]];
    $session = Yii::$app->session;
    if (isset($post["ProductSearch"]) ) {
        $params["ProductSearch"] = $post["ProductSearch"];
    } else {
        $params["ProductSearch"] = $session->get("ProductSearch",[]);
    $dataProvider   = $searchModel->search($params);