Display auto-filter popup dialogs in a CGridView similar to MS Excel auto-filters.

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.


See bitbucket wiki.


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')); ?>


See Yii Extensions Forum Thread.


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


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

Donate with PayPal

Total 2 comments

#13134 report it
jwerner at 2013/05/07 08:42am
Model Behavior


Thanks for pointing me to this missing info.

I have updated the description.

Regards, Joachim

#13130 report it
navy at 2013/05/07 03:16am
Great extension!

Hi, Joachim!

Great extension, but where to get methods textSearchCriteria and dateSearchCriteria? CActiveRecord not have these methods.

They may be implemented as a behavior?

Leave a comment

Please to leave your comment.

Create extension
No downloadable files yet