Add Column In Cgridview Based On Searchfilters


Is it possible to add a column in CGridView based on the searchfilters?

If for example I choose an option from a dropdown and hit search, one column should be added.

I tried to check if a searchcriteria was set in the view and then display another CGridView with an if-statement, but it didn’t work because of ajax I guess.

Any ideas?

Dear Adde

Kindly check wherther the following is helpful.

If dataProvider is $model->dataProvider(), we can add a column in the follwing way.




	     'visible'=>(isset($model->someOtherAttribute) && $model->someOtherAttribute!=="")




Thank you! works great :D