Revision #2 has been created by le_top on Nov 22, 2014, 6:51:47 PM with the memo:
Corrections to the text.
« previous (#1)
Changes
Title
changed
How to simply keep filters simple in CGridView
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
CGridView, filtering
Content
changed
The problem is not new: after setting some filters in a grid (t
iypically in admin view), and gone to another page, returning in the grid's page I would like to find the filters with previous setting mantained.
There are extensions doing that (and more) but I always look for the simplest solution. So, thanking some users that in various contributes approach the problem, this is the simplest way I found.[...]
}
```
The added code to obtain the result is just a few lines, as follows:
```php[...]
One step ahead
--------------
Some more to let clearing filters simpler too.
Just a little action, and a link somewhere in the grid's page to call it.
```php[...]
echo CHtml::link('Pulisci filtri', Yii::app()->controller->createUrl('pulisciFiltro'));
```
Destroying the variable, it restores the initial situation, clearing filters and setting, if present, the default values too.
It's all. Hope this is useful.