Yii CGridView hides only filter input

When using CGridView, filter input fields are automatically generated by the component.

I want to choose which columns the input field will display. For example: My model has 5 columns. I want CGridView to show an input filter ONLY for columns 1 and 2.

Is there a way to do this without using CSS or jQuery by simply adding some code to the CGridView options?

+7
source share
4 answers
array( 'name'=>'col3', 'value'=>'$data->col3', 'filter'=>false, ) 

must work.

+23
source

If you want to remove all filters from the entire CGridView , configure 'filterPosition'=>''

+2
source

Only comments and filter disappear ... Example:

 <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'usuario-grid', 'dataProvider'=>$model->search(), //'filter'=>'false', 'columns'=>array( 'rut_usuario', 

....

0
source

Setting 'filter'=>false, works for me.

0
source

All Articles