avoiding page loading while cgridview pagination in yii

Firstly …

I have controller as




$model=new Profile();

		

		$sql="select * from profile";

		

		$count = Yii::app()->db->createCommand('SELECT COUNT(*) FROM profile')->queryScalar();

		

		$rawData = Yii::app()->db->createCommand($sql);

		

		$dataProviderRegSum = new CSqlDataProvider($rawData, 

				array('pagination'=>array('pageSize'=>4),

				'totalItemCount'=>$count

				));

		if (Yii::app()->request->isAjaxRequest) {

			$done =$this->renderPartial('gridshow', array('datapro' => $dataProviderRegSum,'model'=>$model), false,true);

			

		}

		else {

		$this->render('gridshow',array('model'=>$model,'datapro'=>$dataProviderRegSum));

		}

and in my view





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

		'id'=>'family-record-grid',

		'dataProvider'=>$datapro,

		'enableSorting' => true,

		//'cssFile' => $cssfile,

		//'itemsCssClass'=>'tabchin',

// 			//'ajaxUpdate'=>true,

// 		'pager' => array(

// 				'firstPageLabel'=>'<<',

// 				'prevPageLabel'=>'<',

// 				'nextPageLabel'=>'>',

// 				'lastPageLabel'=>'>>',

// 				'maxButtonCount'=>'10',

// 				'header'=>'<span>Pagination</span>',

// 				'cssFile'=>Yii::app()->getBaseUrl(true).'/themes/phil/css/pager.css',

// 		),

'ajaxUpdate'=>true,

		'ajaxUpdateError'=>'js:function(){alert("Error");}',

		'columns'=>()

));

but ajax pagination is not working …how to get ajax pagination for cgridview …where is the problem…please any help would be appreciated…

Hi Rajesh,

I think the problem is with your ajax configuration setting.





 'ajaxUpdate'=> 'ID_OF_YOUR_GRIDVIEW_CONTAINER' 

[size=2][code][/size]

[size=2]

[/size]

[size=2]For example [/size]

[size=2][code][/size]


  'id' => 'family-record-grid',

  'ajaxUpdate'=> 'family-record-grid'  

[size=2]

[/size]

For more reference -> http://www.yiiframework.com/doc/api/1.1/CGridView

Cheers!

Happy Coding