Update Two Cgridviews With One Submit-Call

Hi,

I have 1 form and 2 CGridviews on one page.

When I submit the form then there are 2 calls two the server for updating both Gridviews.

How can I change that to only one call?

Are there any Options in the yiiGridview.update function so that I can get the result and update both Gridviews manually?

I’m currently using the standard Gridview update function like this:




Yii::app()->clientScript->registerScript('search', "

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

	$.fn.yiiGridView.update('items-grid', {

		data: $(this).serialize()

	});

	$.fn.yiiGridView.update('files-grid', {

		data: $(this).serialize()

	});

	return false;

});

");




Kind regards

Winstonsmith

Hi Winstonsmith,

You can use ‘ajaxUpdate’ property of CGridView:




<?php

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

	'id' => 'items-grid',

	'ajaxUpdate' => 'files-grid',

	...

));

...

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

	'id' => 'files-grid',

	...

));



Sorry for my late reply.

I’ll give it a try.

Thanks for your help.

Kind regards

winstonSmith