PHPackages                             pentium10/yii-remember-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-remember-filters-gridview

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

pentium10/yii-remember-filters-gridview
=======================================

This Yii extension helps you to remember filter values of GridViews during navigation, filters will stick.

1.2.2(12y ago)139108[1 issues](https://github.com/pentium10/yii-remember-filters-gridview/issues)1BSD-2-ClausePHPPHP &gt;=5.3.0

Since Dec 25Pushed 10y ago4 watchersCompare

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

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

yii-remember-filters-gridview
=============================

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

The ERememberFiltersBehavior Yii extension adds up some functionality to the default possibilites of CActiveRecord/Model implementation.

It will detect the **search** scenario and it will save the filters from the GridView. This comes handy when you need to **remember them between navigation** during page changes. For lot of navigation and heavy filtering, this functionality can be activated by just a couple of lines.

It supports **default filter values** and **remember scenarios** also. For example if you want to show only eg: Active Products, you can setup the default filter using this extension. Or if you have the same modal on different views, you can set different scenarios to remember state separated from each other. See the optional params under Advanced Functionalities and Scenarios section.

[![Please login to see the Demo image!](https://camo.githubusercontent.com/544bc690629e590b8fc99f99524961f8253dcd2a4a95f695028057137e23241b/68747470733a2f2f7261772e6769746875622e636f6d2f70656e7469756d31302f7969692d72656d656d6265722d66696c746572732d67726964766965772f6d61737465722f7265732f72656d656d6265725f66696c746572735f31302e706e67 "Demo")](https://camo.githubusercontent.com/544bc690629e590b8fc99f99524961f8253dcd2a4a95f695028057137e23241b/68747470733a2f2f7261772e6769746875622e636f6d2f70656e7469756d31302f7969692d72656d656d6265722d66696c746572732d67726964766965772f6d61737465722f7265732f72656d656d6265725f66696c746572735f31302e706e67)

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/remember-filters-gridview/) (don't forget to cast your support vote)**
- [Report a bug](http://github.com/pentium10/yii-remember-filters-gridview/issues "Report a bug")
- [Forum](http://www.yiiframework.com/forum/index.php?/topic/15847-extension-remember-filters-gridview/ "Forum")
- [Clear Filters Gridview extension](http://www.yiiframework.com/extension/clear-filters-gridview "http://www.yiiframework.com/extension/clear-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-remember-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, just copy this file to your components/ directory, add 'import' =&gt; 'application.components.ERememberFiltersBehavior', \[...\] to your config/main.php and paste the following code to your behaviors() method of your model

```
public function behaviors() {
       return array(
           'ERememberFiltersBehavior' => array(
               'class' => 'application.components.ERememberFiltersBehavior',
			   'defaults'=>array(),           /* optional line */
			   'defaultStickOnClear'=>false   /* optional line */
           ),
       );
}
```

Step 2
------

[](#step-2)

**Your actionAdmin() must not use unsetAttributes() as this was moved to the extension.**

With this extension the actionAdmin instead of the classic

```
        public function actionAdmin()
        {
                $model=new Company('search');
                $model->unsetAttributes();  // clear any default values
                if(isset($_GET['Company']))
                        $model->attributes=$_GET['Company'];
                $this->render('admin',array(
                        'model'=>$model,
                ));
        }
```

can be as simple as:

```
        public function actionAdmin()
        {
                $model=new Company('search');
                $this->render('admin',array(
                        'model'=>$model,
                ));
        }
```

Advanced Functionalities
------------------------

[](#advanced-functionalities)

*(if you use these functionalities please Donate)*

- **'defaults'** is a key value pair array, that will hold the defaults for your filters. For example when you initially want to display `active products`, you set to `array('status'=>'1')`. You can of course put multiple default values in the array.
- **'defaultStickOnClear'=&gt;true** can be used, if you want the default values to be put back when the user clears the filters The default set is `false` so if the user clears the filters, also the defaults are cleared out, the user will get an absolutely clean filter form. When `true`, if the form is cleared, he will get a form with defaults values.

Scenarios
---------

[](#scenarios)

*(if you use these functionalities please Donate)*

You can use `scenarios` to remember the filters on multiple states of the same model. This is helpful when you use the same model on different views and you want to remember the state separated from each other.
Known limitations: the views must be in different actions (not on the same view)

To set a scenario add the setRememberScenario call after the instantiation
Sample code:

```
        public function actionAdmin()
        {
                $model=new Company('search');
				$model->setRememberScenario('scene1');
                $this->render('admin',array(
                        'model'=>$model,
                ));
        }
```

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

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

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

[](#change-log)

[CHANGELOG.md](http://github.com/pentium10/yii-remember-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 "Added Sorting"`)
4. Push to the branch (`git push origin my_enhancement_name`)
5. Open a [Pull Request](http://github.com/pentium10/yii-remember-filters-gridview/pulls)
6. Enjoy a refreshing Diet Coke and wait

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% 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

4527d 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 (17 commits)")[![progmult](https://avatars.githubusercontent.com/u/13451636?v=4)](https://github.com/progmult "progmult (1 commits)")

---

Tags

modelinterfaceBehaviorstorewidgetyiicontrollerfiltersrememberscenariogridviewreloadCGridViewstick

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/pentium10-yii-remember-filters-gridview/health.svg)](https://phpackages.com/packages/pentium10-yii-remember-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)
