Styling Column In Cgridview

Hi Community,

I’m trying to add a css style to a column in a CGridView, but it doesn’t work, here is part of the code:

In admin.php (view folder):

<?php $this->widget(‘zii.widgets.grid.CGridView’, array(





	array( 'name' =&gt;'id_juridica', 'value' =&gt; '&#036;data-&gt;id_juridica', 'header' =&gt; 'No Empresa', 'htmlOptions' =&gt; array('class'=&gt;'red')),

	...others columns

	array( 'class'=&gt;'CButtonColumn', 'template' =&gt; '{view}'),


)); ?>

Only I want to display the column ‘id_juridica’ in red color, so I’d created a class red in my main.css file, here is the code:






and I’m using ‘htmlOptions’ => array(‘class’=>‘red’) to apply the class in the colummn.

What I’m doing wrong ?, any help will be apreciated, thanks in advance.

Are you using your own css file or the main.css that came with your yii application?

I just recreated it the way you have and it worked without problems for me,

My GridView


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

    'id' => 'activity-grid',

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

    'filter' => $model,

    'columns' => array(



            'name' => 'name',

            'value' => '$data->name',

            'htmlOptions' => array('class' => 'red'),



            'class' => 'CButtonColumn',





and my main.css (The one that came with the Yii application)






Thanks Edofre, the problem was in the browser’s cache. I clean it and it works.

Thanks Community