view
$this->renderPartial('/serviceoffer/offergrid',array('dataProvider'=>$offersMadeDataProvider,
'isClient'=>$isClient,
'unlocked' => $unlocked,
'gridID'=>'offers-grid'),false,true);
$this->renderPartial('/serviceoffer/offergrid',array('dataProvider'=>$starredOffersDataProvider,
'isClient'=>$isClient,
'unlocked' => $unlocked,
'gridID'=>'starred-offers-grid'),false,true);
$this->renderPartial('/serviceoffer/updated-offergrid',array('dataProvider'=>$updatedOffers,
'gridID'=>'updated-offers-grid'),false,true);
The ‘updated-offers-grid’ uses an extended datagrid made by me but when I remove ‘updated-offergrid’ from the view I still get the same problem.
So, with ‘updated-offers-grid’ removed I only have 2 datagrid in the view and now ‘offers-grid’ makes 2 ajax call instead of 3, and ‘starred-offers-grid’ makes only 1 call instead of 2.
controller
$model=$this->loadModel();
// http://www.yiiframework.com/forum/index.php?/topic/13191-gridview-ajax-requests-entire-page/
if(Yii::app()->request->isAjaxRequest){
if(isset($_GET['ajax'])){
if($_GET['ajax'] == 'updated-offers-grid'){
if($model->client == Yii::app()->user->getId()){
$updatedOffers=Serviceorder::model()->getOfferUpdates($model->id);
$this->renderPartial('/serviceoffer/updated-offergrid',array( 'dataProvider'=>$updatedOffers,
'gridID'=>'updated-offers-grid'),false,true);
}
Yii::app()->end();
}
if($_GET['ajax'] == 'starred-offers-grid'){
if($model->client == Yii::app()->user->getId()){
$starredOffers=Serviceoffer::model()->searchStarredOfferByOrder($model->id);
$this->renderPartial('/serviceoffer/offergrid',array( 'dataProvider'=>$starredOffers,
'isClient'=>1,
'unlocked' => $model->unlocked,
'gridID'=>'starred-offers-grid'),false,true);
}
Yii::app()->end();
}
if($_GET['ajax'] == 'offers-grid'){
$offersMade=Serviceoffer::model()->searchOfferByOrder($model->id);
$this->renderPartial('/serviceoffer/offergrid',array( 'dataProvider'=>$offersMade,
'isClient'=>1,
'unlocked' => $model->unlocked,
'gridID'=>'offers-grid'),false,true);
Yii::app()->end();
}
}
}
....
Please note that when I removed the above code from the controller I still get the same problem.
/serviceoffer/offergrid.php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>$gridID,
'dataProvider'=>$dataProvider,
'ajaxUpdate'=>true,
'pager'=>array('class'=>'CLinkPager',
'header'=>'',
'maxButtonCount'=>6,
'prevPageLabel'=>'< Prev',
),
'columns'=>$columns,
'showTableOnEmpty'=>true,
'emptyText'=>$emptyText,
));
Thanks.