How to hide CGridView Filter

Hi,

Does anyone know how to hide the filter textbox in CGridView? I intend to remove it, 'cause I think I can just use Advance Search instead. Thx before.

Could you provide your GridView code?

Do you have the ‘filter’ property specified? If so, remove it completely and that should remove the filter boxes from the columns.

comment out the filter property as GDzyne said

for example, illustrating:




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

	'id'=>'user-grid',

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

//	'filter'=>$model,

	'columns'=>array(

		'userId',

		'userName',

		'userFullName',

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>



regards!

:)

It is worth noting that you can supply ‘null’ to the filters attribute to hide filters only in some required situations…




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

        'id'=>'user-grid',

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

      'filter'=>($show_filters ? $model : null),

        'columns'=>array(

                'userId',

                'userName',

                'userFullName',

                array(

                        'class'=>'CButtonColumn',

                ),

        ),

)); ?>