htmlOptions is not working under CDetailView

ref to:

article

attempt to change display cell background color, no luck, I end up hack ‘value’; but why not htmlOptions?




<?php $this->widget('zii.widgets.CDetailView', array(

	'data' => $model,

	'attributes' => array(

		'field1',

		array(

			'class'=>'DataColumn',

			'name'=>'field2',

			//'type' => 'raw',

			'value' => $data->field2,

            //'evaluateHtmlOptions'=>true,

            'htmlOptions'=>array('style'=>'{background-color:#FFFFCC;}'),

		),	


~~~



Your formatting is wrong. Try removing the brackets.

Try this:


'htmlOptions'=>array('style'=>'background-color:#FFFFCC;'),

If that fails, maybe:


'htmlOptions'=>array('style'=>'background-color:#FFFFCC !important;'),

thanks, still no luck with both,

There’s a good post here that may help:

http://www.yiiframework.com/forum/index.php?/topic/16757-how-to-change-style-of-cdetailview/

thanks a lot, i will take a look.