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 en
d us
ing 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![...]