Difference between #6 and #7 of
Clear CGridView Filters, Sort & Pager

Revision #7 has been created by le_top on Nov 26, 2014, 8:40:23 AM with the memo:

Changed expllication because this is also useful when not remembering filters.
« previous (#6)

Changes

Title unchanged

Clear CGridView Filters, Sort & Pager

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

CGridView, filter, filters, filtering, clear filters, clear, gridview, reset, remember

Content changed

Clearing sorting and filters of CGridViews or derivatives whCGridView filters and sort orders from the web pages, is usefull for the end using methods to remember those filters is not very much covered.  Here is an alternative.
 
 
er.  Yii does not seem to propose a standard method.  Furthermore, this is especially usefull when filters are "remembered" in the user's session.
 
 
To remember filters, 
I use [ERememberFiltersBehavior](http://www.yiiframework.com/extension/remember-filters-gridview "RememberFiltersBehavior") and a previous wiki also shows a method to remember filters. Prior to developing an method, I looked at what existed already.
 
To clear filters, 
[EButtonColumnWithClearFilters](http://www.yiiframework.com/extension/clear-filters-gridview "Clear Filters GridView") supposedly does the job, and a [web page](http://hafiznor.wordpress.com/2013/01/10/yii-reset-filter-on-gridview/ "Yii Reset Filter On GridView") / [forum entry](http://www.yiiframework.com/forum/index.php/topic/14242-modifying-cgridviews-default-filtersearch-behaviour/page__view__findpost__p__70802 "forum entry") also explain a method.

They did not meet my "requirements", so I worked out another method.

The code is not perfect yet (I would like to not use 'window.location.href'), but I thought sharing this is usefull for you. If you work out a better way, share it here!
[...]
2 0
3 followers
Viewed: 18 695 times
Version: 1.1
Category: How-tos
Written by: le_top
Last updated by: le_top
Created on: Nov 23, 2014
Last updated: 9 years ago
Update Article

Revisions

View all history