How to hide a column in CGridView

Halo,

How do i hide a column in CGridView ??

in the view

remove the column name you dont like





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

	'id'=>'phones-grid',

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

	'filter'=>$model,

	'columns'=>array(

	//remove the column name listed here

		'phone_ime',

		'item.item_name',

		'item.item_price',

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>



thx for the answer,

but i just want hide the column, the column should still exist in source code.




'columns' => array(

 array(

  name => 'column_name',

  visible => 'true',

 ),

 array(

  name => 'column_name2',

  visible => 'false',

 ),

),




'columns'=>array(

  array(

    'name'=>'a_id',

    'visible'=>'false',

),

visible => ‘false’ don’t work,

colums is still visible.

You can’t just comment out the column name?

if i do so

only the header name/label disappers, the header and the body (incl values) is still there.

here the source code


<th id="gas-tar-grid_c0">&nbsp;</th>

use false instead of ‘false’

visible=> false works, but now the column is completely gone, it dosn’t exist in the source code,

but i need the column (values inside), i just want to hide it like


'htmlOptions'=>array(

  'style'=>'display:none',

but this snippet code hides only the column body, the head is still visible

I am not sure if it’s possible in HTML (I’m a C++ programmer), but a width of ‘0’ ought to do it.




array(

  'headerHtmlOptions'=>array('style'=>'display:none'),

  'htmlOptions'=>array('style'=>'display:none'),

),



will work, but if we have many hidden columns, it can raise another problem. I post a question about this here.