yii-ddautofilter /

Filename Size Date modified Message
231 B
5.1 KB
14.9 KB
1.7 KB
5.2 KB
2.7 KB


DDAutoFilter is a Yii extension to display auto-filters in a CGridView similar to MS Excel auto-filters.

It is currently working with Yii-bootstrap based Yii applications.


Download or clone from bitbucket under protected/extensions/diggindata, so that you have a folder protected/extensions/diggindata/ddautofilter.


Model Behavior

In your model's behaviors method, add the DDAutoFilterSearchBehavior:

public function behaviors(){
    return array(
        'autoFilterSearchBehavior' => array(
            'class' => 'ext.diggindata.ddautofilter.DDAutoFilterSearchBehavior',

Model / search Method

In your CActiveReord model's search() method, for each column that shall be displayed using auto-filters, change the $criteria line.

// Replace:
// ... with:
$criteria->mergeWith($this->textSearchCriteria('title', $this->title));

For date columns, use:

$criteria->mergeWith($this->dateSearchCriteria('title', $this->title));

For timestamp columns, use:

$criteria->mergeWith($this->dateSearchCriteria('title', $this->title, 'U'));

Grid View

Grid View Properties

Add some code to the CGridView afterAjaxUpdate property:

<?php $this->widget('ext.bootstrap.widgets.TbGridView', array(
    'id'=>'your-model-grid', // see below
    )); ?>
Grid View Columns
    'columns' => array(
            'columnType'=>'number', // or 'text' or 'date' or 'bool'
            'filter => array(1=>1, 2=>2, 3=>3), // will be displayed in values select multiple control
Auto-Filter Widget

After the CGridView widget code, add:

<?php $this->widget('ext.diggindata.ddautofilter.DDAutoFilterWidget', array('gridId' => 'your-model-grid')); ?>


  • V0.1: (2013-05-06) Initial version


If you like this extension, please consider donating a bit:

Donate with PayPal