Problem in Pagination with Ajax

Hi All,

I am using CPagination and CLinkPager Classes for paging.

I want to apply Ajax for each paging link.

For this purpose i have written one ExtCLinkPager class which extend the CLinkPager class and i have overridden the following method:-

protected function createPageButton($label,$page,$class,$hidden,$selected)


	if($hidden || $selected)

			$class.=' '.($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE);


	if (!$hidden)


		if($this->objId!='' && $this->ajaxLoaderId!='')

			return '<li class="'.$class.'">'.CHtml::ajaxLink($label,$this->createPageUrl($page),array(

												'type' => 'POST',

												'update' => '#'.$this->objId,

												'beforeSend' => 'js:function(){document.getElementById("'.$this->ajaxLoaderId.'").style.display="block";}',

												'complete' => 'js:function(){document.getElementById("'.$this->ajaxLoaderId.'").style.display="none";}',

												'error' => 'js:function(){alert("Ajax request error in pagination");}',)).'</li>';


			return '<li class="'.$class.'">'.CHtml::link($label,$this->createPageUrl($page)).'</li>';



	return '<li class="'.$class.'">'.CHtml::link($label,'').'</li>';


I have also declare to public variables in this class:-

public $objId;	

public $ajaxLoaderId;

In my view i am using following code for pagination:-

$this->widget('ExtCLinkPager',array('pages' => $pages, 'objId' => 'searchResult', 'ajaxLoaderId' => 'ajaxLoader', 'firstPageLabel' => Yii::t('BillingModule.billuser','&lt;&lt; First'), 'nextPageLabel' => Yii::t('BillingModule.billuser','Next &gt;'), 'prevPageLabel' => Yii::t('BillingModule.billuser','&lt; Previous'), 'lastPageLabel' => Yii::t('BillingModule.billuser','Last &gt;&gt;'))); 

In my controller i am using following code;-

$pages = new CPagination(RadUser::model()->with(array("location" => array('select' => 'LocationName'),"plan" => array('select' => 'PlanName')))->count($criteria));

$pages->pageSize = 50;


$this->render('list', array("radUserModel" => $radUserModel, "radUserData" => $radUserData, "sort" => $sort, "pages" =>$pages));

All these code is working perfectly with Google Chrome but it is not working in IE and Firefox.

I have also seen the Error Console Section of Firefox but it is not showing any error.

Can anyone help me on this?


Return true from beforeSend() ?

(not tested)


Hi Tommy,

I tried return true in beforeSend but it is not working.

Any other solution?