How to not populate CGridView until a search has been carried out?

I’ve been playing around with CGridView for a day or two now.



so data is populated.

Everything is working fine except that I would like if the grid was not populated with model data until a search was carried out on it. I’ve already tried to send an empty model to the CGridView’s dataProvider from a different function inside the model class, but that makes any future data that should populate in the grid fail. Anyone have a solution?

You can check if $_POST[‘model_name’] is not set, in this case not to popolate data provider.

You can either not to show the CGridView or add a condition = ‘false’ or anithing else.

The best is not to show and display a message like "search something"

Thanks zaccaria. I resorted to the show/hide idea. I was hoping I’d be able to pass a parameter to CGridView or something similar as it would be a cleaner solution. Show/Hide will do me fine. thanks