Update Data In Search Dropdown


I’m using the standard yii code for searching and updating a yii grid view:

$('.search-form form').submit(function(){

	$('#item-grid').yiiGridView('update', {

		data: $(this).serialize()


	return false;


The search form consists of two dropdown fields. The problem: The content of dropdown two depend on the selected value in dropdown one.

I implemented this in php, but the problem is, that the piece of jquery code above updates just the grid view. Is there a possibility to also update the search form? The ajax calls gets the whole html code, so I guess this is possible.

Any ideas?


In search method , you should set the value which has been selected previously…

Then it will be selected on your next call :)


In your grid view use filer …


$this->widget('zii.widgets.grid.CGridView', array( 

	'itemsCssClass' => ' ', 





//your filds



and in ur controller’s action just do this…

public function actionActionName()


			$dataProvider=new CActiveDataProvider('Your_Model',array(


														'defaultOrder'=>'date_created DESC',





		$model=new YourModel('search');

		$model->unsetAttributes();  // clear any default values