Using Ejuicombobox For Cgridview Filtering


Has anyone ever tried using a EJuiComboBox to perform CGridView filtering?

I just tried something like this in a CGridView column definition:






It returns no error but the column has no filtering header…

I have to dig it a little more, but in case someone else did the same please share your solution!


Make the widget to return the value instead of printing directly:




  'filter'=>$this->widget("ext.combobox.EJuiComboBox",array('model'=>$model,'attribute'=>'attr'), true),


3rd parameter to true

indeed that works, thanks!

at least it displays the combobox, but that doesn’t mean it works :smiley:

I have to check out more what’s going on.

thanks so far!

For benefit of others here’s the full solution.

Install combobox extension.

First patch your combobox javascript with this.

In the CGridView column definition add the widget:



            'filter'=>$this->widget('ext.combobox.EJuiComboBox', array(

                    'model' => $model,

                    'attribute' => 'attributeName',

                    'data' => CHtml::listData(YourModel::model()->findAll(),'id','description'),

                    'options' => array(

                    'allowText' => false,




Since on the CGridView update the javascript is lost we need to reinstall ComboBox on every change.

So in the CGridView options, before ‘columns’, add:

'afterAjaxUpdate' => 'reinstallComboBox',

then later on on the view:

<?php Yii::app()->clientScript->registerScript('re-install-combobox', "

function reinstallComboBox(id, data) {



"); ?>

Replace YourModel with your model name, attributeName with the attribute name you’re trying to filter.