Losing css when search by CgridView filters

Hy everyone, good morning!

I found a topic with similary error, but it didnt help me:

My error: i used some css in selects (combos) field to make it pretty, i got from this site:

http://www.adamcoulombe.info/lab/jquery/select-box/

When i use the filter in CgridView (in my cgridview has select fields), this select lost the css script…how can i fix that?

some pics:

before

after

You can use "afterAjaxUpdate" of CGridView to re-apply the CSS style javascript plug-in.

Or, I’d rather modify the css file and add some customized style to those combo boxes in the grid header.

there`s someway to refresh a css file in afterAjaxUpdate??

As you can specify the dropdownlists(comboboxes) in the CGridView header by a query of “.grid-view thead select”, it’s very easy to apply the custom style to them.




.grid-view thead select {

    background:url(canvas-list-nav-item-arrow-.gif) no-repeat center right;

}



There’s no need to use a single line of javascript.

But if you do have to use a script to style the dropdownlists, then you can use ‘afterAjaxUpdate’.




Yii::app()->clientScript->registerScript('re-apply-dropdown-style', "

function reApplyDropdownStyle(id, data) {

    $('.grid-view thead select').customSelect();

}

");

...

$this->widget('zii.widgets.grid.CGridView', array(

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

	'filter' => $model,

	'afterAjaxUpdate' => 'reApplyDropdownStyle',

	'columns' => array(

		'foo',

		'bar',

		...

	),

));



http://www.yiiframework.com/doc/api/1.1/CGridView/#afterAjaxUpdate-detail