Cgridview Column Visibility

Is there any way to hide/show the gridview column depending on whether the search form field is blank/not?

Any suggestion or tips will be highly appreciated.

Thanks in advance.

If you use the standard actionAdmin (generated by gii), the submitted model attributes are populated with the search values.

So you can check the attributes of the model to set the visibility property of a column:






            'name' => 'attribute1',

            'visible' => !empty($model->attribute1),