Advance Search Feild

I want to make the Advance search feild stand alone. After data is submitted Id Like the Grid to be displayed? Any Ideas?

Right now when the grid is displayed by default. Id like to hide it until the search button is pushed.

You can make advance action in your controller, that would have same values like inpage search/results.

In case you need pagination, you must have hidden fields that will keep values from separated search page.

Do you have any examples on how to do that?

The default code generated by Gii has an advanced search that uses ajax to transfer the entered values to the grid filter fields and then submits as those where entered directly on the grid filter fields…

So if you want to use the advanced form without the grid then you need to change the default code and generate a form that will submit the data entered…

There are no code/examples for this as until now there where no similar posts (IMO)

Is there a way to make it default to "No results found" until there a search has been made?

You just need to return an empty activeDataProvider in $model->search()

How do I do that?

To return an empty CActiveDataProviter you can use this:




return new CActiveDataProvider(get_class($this), array('data'=>array()));



So you would like to not display all the data… only when there is something "filtered" to display the result…

The main problem is how to know when to return empty and when to return actual data…

One possible solution is to check if the filter data has been submitted… something like




public function search()

{

   $class=get_class($this);

   if(!isset($_GET[$class]))

  	return new CActiveDataProvider($class, array('data'=>array()));

		

   $criteria=new CDbCriteria;

   ...

   return new CActiveDataProvider($class, array('criteria'=>$criteria));

}