Difference between #1 and #2 of
How to keep filters simple in CGridView

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)


Title changed

How to simply keep filters simple in CGridView

Category unchanged


Yii version unchanged

Tags unchanged

CGridView, filtering

Content changed

The problem is not new: after setting some filters in a grid (tiypically 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 t
he result is just a few lines, as follows:

One step ahead
Some more to let cle
aring filters simpler too.  Just a little action, and a link somewhere in the grid's page to call it.

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 de
fault values too. It's all. Hope this is useful.
0 0
Viewed: 11 129 times
Version: 1.1
Category: How-tos
Written by: Peppe
Last updated by: le_top
Created on: Nov 22, 2014
Last updated: 7 years ago
Update Article


View all history