Search In Cgridview With Cactivedataprovider

Hi folks!

I’m working on a grid view for which I need to implement a search.

The problem is I’m using a dataProvider based on a CActiveDataProvider (a multi-table query) and not from a model, so I can’t use the [model]->search() method for the search.

I’ve been searching through this forum posts and not only, but I didn’t find anything useful to put in place a search.

This is what I have in my grid view:




<?php $this->widget('ext.groupgridview.GroupGridView', array(

	'id'=>'grid1',

	'dataProvider'=>$dataProvider,

...

	),

...

)); ?>



$dataProvider is provided by the controller, of course, and, as I wrote above, is a CActiveDataProvider resulting from a multi-table query.

Do you have any hint to help me on solving this issue?

Thx! :)

If you use grid only to view data (and not to edit or add), you can create a view in database from your query.

After this just generate model from your db view (use gii) and use it instead CActiveDataProvider…

Thank you very much luk1999!!

You are obviously right :) (even if everything becames obvious once someone other explained you how to do it ;D ).

You saved me a lot of time on trying to find out a solution for that ;)

Regards.