Remember Grid Filters

Is there an easy way to remember the grid filter settings, so when the user comes back the same filters are shown?

I would use session for this.

The grid uses a search model for the filtering:

As long as you can persist that in some way, you should be fine.

I am not sure if I am on the right track…

  1. I store the value of the $param in the controller/search in a session

  2. In the update I need to redirect back to the index

2a) In the update I retrieve the value from the session

2b) I call : return $this->redirect([‘index’]);

The thing I am struggeling with now is how to pass the search variables to the url

The index url is something like


This is urlencoded of


But how do I turn a php array to this format for passing into the

return $this->redirect([‘index’, -->values here<—]);

hmmm interesting… as soon as one formulates the question the answer comes to mind…


However, now the redirect still does not work

return $this->redirect(['index',http_build_query($param) ]); 

it turns the url into something like


instead of


I just found another solution

In the actionIndex I store the used url (including parameters)


in the redirect I call

redirect(Url:previous(‘namex’) );

it seems to work very nice…

aNd so much simpler…