PHPackages                             pentium10/yii-clear-filters-gridview - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pentium10/yii-clear-filters-gridview

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pentium10/yii-clear-filters-gridview
====================================

This yii extension helps you to clear remembered filter values on GridViews, by using the additional top right image.

1.0.2(12y ago)222071BSD-2-ClausePHPPHP &gt;=5.1.0

Since Dec 25Pushed 12y ago2 watchersCompare

[ Source](https://github.com/pentium10/yii-clear-filters-gridview)[ Packagist](https://packagist.org/packages/pentium10/yii-clear-filters-gridview)[ RSS](/packages/pentium10-yii-clear-filters-gridview/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (1)Versions (2)Used By (1)

yii-clear-filters-gridview
==========================

[](#yii-clear-filters-gridview)

The EButtonColumnWithClearFilters Yii extension adds up some functionality to the default possibilites of CButtonColumn implementation when you use extensions to remember filter values. This extension helps you to **clear the remembered filter values**.

Check out [Remember Filters Gridview](http://www.yiiframework.com/extension/remember-filters-gridview/) extension also.

**An image will be placed in the top column(on same line of AJAX filters). When clicked the filters will be cleared, the content will be refreshed with all items available.**

[![Please login to see the Demo image!](https://camo.githubusercontent.com/2ffb20bfcd8b45cc60b55c266a92f2b36aee41750455304e780977a1613ffaf6/68747470733a2f2f7261772e6769746875622e636f6d2f70656e7469756d31302f7969692d636c6561722d66696c746572732d67726964766965772f6d61737465722f7265732f636c6561725f66696c746572735f31302e706e67 "Demo")](https://camo.githubusercontent.com/2ffb20bfcd8b45cc60b55c266a92f2b36aee41750455304e780977a1613ffaf6/68747470733a2f2f7261772e6769746875622e636f6d2f70656e7469756d31302f7969692d636c6561722d66696c746572732d67726964766965772f6d61737465722f7265732f636c6561725f66696c746572735f31302e706e67)

Requirements
------------

[](#requirements)

- Yii 1.1

Donate
------

[](#donate)

[Click here to donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K9TM6HR8JQ4Z8 "Donate")

Resources
---------

[](#resources)

- **[Extension page](http://www.yiiframework.com/extension/clear-filters-gridview/) (don't forget to cast your support vote)**
- [Report a bug](http://github.com/pentium10/yii-clear-filters-gridview/issues "Report a bug")
- [Forum](http://www.yiiframework.com/forum/index.php?/topic/15845-extension-clear-filters-gridview/ "Forum")
- [Remember Filters Gridview extension](http://www.yiiframework.com/extension/remember-filters-gridview)

Install
-------

[](#install)

We recommend installing the extension with [Composer](http://getcomposer.org/). Add this to the `require` section of your `composer.json`:

```
"pentium10/yii-clear-filters-gridview" : "dev-master"

```

You also need to include composer's autoloader:

```
    require_once __DIR__.'/protected/vendor/autoload.php';
```

Usage
-----

[](#usage)

Step 1
------

[](#step-1)

To use this extension, copy this file to your components/ directory, add 'import' =&gt; 'application.components.EButtonColumnWithClearFilters', \[...\] to your config/main.php and use this column on each widget's Column array you would like to inherit the new possibilities:

```
array(
  'class'=>'EButtonColumnWithClearFilters',
   //'clearVisible'=>true,
   //'onClick_BeforeClear'=>'alert('this js fragment executes before clear');',
   //'onClick_AfterClear'=>'alert('this js fragment executes after clear');',
   //'clearHtmlOptions'=>array('class'=>'custom-clear'),
   //'imageUrl'=>'/path/to/custom/image/delete.png',
   //'url'=>'Yii::app()->controller->createUrl(Yii::app()->controller->action->ID,array("clearFilters"=>1))',
   //'label'=>'My Custom Label',
 ),
```

All posible customizations have been enumerated above, you shall comment out those that you won't override. The minial setup is just the class type for the Columns. In addition to this you can still use/override the CButtonColumn to suit your needs.

- **clearVisible**: a PHP expression for determining whether the button is visible
- **onClick\_BeforeClear**: If you want to execute certain JS code before the filters are cleared out, use this property to pass your custom code. You are allowed to use 'return false;' only, when you want to stop the clear to happen. This will stop all further JS code, and HTTP request to be executed. You are not allowed to use 'return true;' it will break the components usage.
- **onClick\_AfterClear**: If you want to execute certain JS code after clear, but before the AJAX call use this property to pass your custom code. You are allowed to use 'return false' only, when you want to stop the AJAX call to happen. This will stop the form to be reloaded. If you want to clear the form by classic GET request, and not by ajax you shall 'return true;' here.
- **clearHtmlOptions**: Associative array of html elements to be passed for the button Default is: array('class'=&gt;'clear','id'=&gt;'cbcwr\_clear','style'=&gt;'text-align:center;display:block;');
- **imageUrl**: image URL of the button. If not set or false, a text link is used Default is: $this-&gt;grid-&gt;baseScriptUrl.'/delete.png'
- **url**: a PHP expression for generating the URL of the button Default is: 'Yii::app()-&gt;controller-&gt;createUrl(Yii::app()-&gt;controller-&gt;action-&gt;ID,array("clearFilters"=&gt;1))'
- **label**: Label tag to be used on the button when no URL is given Default is: Clear Filters

Step 2
------

[](#step-2)

If you are using the [Remember Filters Gridview](http://www.yiiframework.com/extension/remember-filters-gridview "http://www.yiiframework.com/extension/remember-filters-gridview") extension, you need to add to your controller the following code. This is placed in the action method that handles the gridview display, after you have initialized your model.

```
if (intval(Yii::app()->request->getParam('clearFilters'))==1) {
    EButtonColumnWithClearFilters::clearFilters($this,$model);//where $this is the controller
}
```

Sample actionAdmin()

```
public function actionAdmin() {
        $model = new registration('search');
		if (intval(Yii::app()->request->getParam('clearFilters'))==1) {
			EButtonColumnWithClearFilters::clearFilters($this,$model);//where $this is the controller
		}
        $this->render('admin', array(
            'model' => $model,
        ));
}
```

If you don't need the clear filters button capabilities you can also pass a `clearFilters` parameter with a 1(one) value to the controller, for this you can use a link or a button.

This extension has also a pair [Remember Filters Gridview](http://www.yiiframework.com/extension/remember-filters-gridview "http://www.yiiframework.com/extension/remember-filters-gridview")

yii, clear, filters, cgridview, gridview, store, reload, controller, model, behavior, interface, widget, stick, scenario

Change Log
----------

[](#change-log)

[CHANGELOG.md](http://github.com/pentium10/yii-clear-filters-gridview/blob/master/CHANGELOG.md)

Contributing
------------

[](#contributing)

1. Fork it.
2. Create a branch (`git checkout -b my_enhancement_name`)
3. Commit your changes (`git commit -am "Enhanced Javascript"`)
4. Push to the branch (`git push origin my_enhancement_name`)
5. Open a [Pull Request](http://github.com/pentium10/yii-clear-filters-gridview/pulls)
6. Enjoy a refreshing Diet Coke and wait

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4521d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/465691?v=4)[Pentium10](/maintainers/pentium10)[@pentium10](https://github.com/pentium10)

---

Top Contributors

[![pentium10](https://avatars.githubusercontent.com/u/465691?v=4)](https://github.com/pentium10 "pentium10 (8 commits)")[![WILL-I-AM](https://avatars.githubusercontent.com/u/2346670?v=4)](https://github.com/WILL-I-AM "WILL-I-AM (2 commits)")

---

Tags

modelinterfaceBehaviorwidgetyiicontrollerfiltersrememberresetcleargridviewemptyCGridView

### Embed Badge

![Health badge](/badges/pentium10-yii-clear-filters-gridview/health.svg)

```
[![Health](https://phpackages.com/badges/pentium10-yii-clear-filters-gridview/health.svg)](https://phpackages.com/packages/pentium10-yii-clear-filters-gridview)
```

###  Alternatives

[sjaakp/yii2-taggable

Manage tags of ActiveRecord in Yii2.

3030.6k](/packages/sjaakp-yii2-taggable)[sjaakp/yii2-alphapager

Page data on initial character in Yii2.

184.4k](/packages/sjaakp-yii2-alphapager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
