Filter In Tbgridview

Hi

I have used CHOSEN extension in TbGridview filter.When first time page load then CHOSEN extension is working fine but whenever I change value from CHOSEN dropdownlist then normal dropdownlist is showing (i can search in dropdowlist items).

admin.php




Yii::import('ext.chosen.Chosen');

$this->widget('bootstrap.widgets.TbGridView', array(

    'type'=>'striped bordered condensed',

    'dataProvider'=>$model->search(),

    'template'=>"{items}{pager}",

	'filter'=>$model,

    'columns'=>array(

        array('name'=>'id', 'header'=>'Product ID'),

    		array('name'=>'name', //'header'=>'Type',

    				'filter' => CHtml::listData(Products::model()->findall("edt IS NULL ORDER BY name"), 'id', 'name'),

    		),

    		array('name'=>'specifications'),

    		//array('name'=>'PT.product_type', 'header'=>'Type'),

    		array('name'=>'ptype', //'header'=>'Type',

    				'value'=>'ProductType::model()->findByPk($data->ptype)->product_type',

    				'filter' => Chosen::activeDropDownList($model, "ptype", CHtml::listData(ProductType::model()->findall("edt IS NULL ORDER BY product_type"), 'id', 'product_type'))

    				),

    		array(

            'class'=>'bootstrap.widgets.TbButtonColumn',

            'htmlOptions'=>array('style'=>'width: 50px'),

        		//'template'=>'{view}{update}{delete}',

        		'buttons'=>array(        				

        				'delete' => array(

        						//'url'=>'Yii::app()->controller->createUrl("ports/delete", array("id"=>$data[id],"command"=>"delete"))',

								'visible'=>'false'

        				),

        		),

        ),//*/

    ),

));



I have added ‘afterAjaxUpdate’ => ‘applyChosen’, in the widget and register following script and my problem solved.




Yii::app()->clientScript->registerScript('apply-Chosen', "function applyChosen(id, data) { $('select.chosen').data('placeholder','Select option').chosen(); }");