CGridView align right for decimals

I have a column of decimals in CGridView. What’s the simplest way to set the entire column (except header) to be right-aligned? Is there a way to specify a css class for the column data?

I tried specifying "colname:number" in the columns array. The data got right-aligned, but my decimals were rounded to integers.

Try setting this property of CDataColumn

(not tested)


Hi, i do it with:

... CGridView Columns ...

array('name'=>'valor_neto','htmlOptions'=>array('style' => 'text-align: right;')),

... other CGridView Columns

Best Regards

thanks a lot …my problem is solved by this

I tried

array (

			'name' => 'mwChainStock',

			'htmlOptions' => array ('style' => 'text-align: right;' ),


But no ‘style’ attribute is rendered into html. Why ?