How to hide a column in CGridView


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(





	//remove the column name listed here








)); ?>

thx for the answer,

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

'columns' => array(


  name => 'column_name',

  visible => 'true',



  name => 'column_name2',

  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



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.





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