CGridView maintain filter parameters when returning

When searching through CGridView if you navigate away from the page, when you return, all of the search parameters are reset. It would be nice if when you returned to the Grid View (such as when you click the back button) that the parameters would be maintained. Does anyone have any thoughts about how to go about accomplishing this? I was thinking of storing the parameters in a cookie and then using that to set the default values.

Check out this extension


That is perfect, thank you. The default values will be useful as well.

I have a quick question for you. I have two different views that each have a CGridView for the same model (different layout). When I filter in one view, the values are then "remembered" in the other view. Do you know if there is a way to disable the "memory" in a specific grid?

Sorry, I’m not the author and I haven’t yet used this extension.

I think would try detachBehavior though. (May not work for models despite they also are CComponents, IIRC at least attachBehavior can’t be used.)

If you also want to save a second set of filters, I don’t know the answer.


Thanks for the tip.

I’m not sure I did it right, I did something like this:

$data = $model->search();


$this->widget('zii.widgets.grid.CGridView', array(

    'dataProvider' => $data,


It didn’t generate any errors, and the filters were still remembered. I’ve posted a comment on the extension page, hopefully the author might have some useful input.