ClinkPager & Ajax

hi all ,

i have a question about implementing ‘ClinkPager’ with ajax.

i have a page where i want to display users comments and i’m doing it with CLinkPager.

i extended CLinkPager because i wanted to change the links to be ajax Links with additional params i wanted.

anyway ,

my problem is that i want the ClinkPager to update a DIV (that works) but the ClinkPager Doesnt included inside that div.

so …

i need to change the CLinkPager’s links (just the ones for next and previous) AFTER anyone of the page numbers clicked …

is This possible ??

The Extended CLinkPager’s code is :

class CommentsPager extends CLinkPager{

    public $videoID;

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


            $perPage = $this->getPageSize();

            $startIndex = $page*$perPage + 1;

            $beforeSendFunc = <<<EOF


//                $('body').undelegate('#button-PrevTop', 'click');//undelegete the 'click' event ( Yii Ajax BUG)

                $(".page").removeClass("selected");//remove selected from current



                $('body').undelegate('.previous a','click');

                $('body').undelegate('.next a','click');



            $SuccessFunc = <<<EOF

            function success(data, textStatus, jqXHR)






            $errorFunc = <<<EOF

            error(jqXHR, textStatus, errorThrown)






                if($hidden || $selected)

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

                return '<li class="'.$class.'">'.CHtml::ajaxLink($label,
















anyone has an idea how i should solve this ??

I just included some jquery to the bottom of my view to override the click function of each link.

For the widget I added an ID, eg

<?php $this->widget('CLinkPager', array(

				'pages' => $pages,




				)) ?>

Then I added the following javascript to my view



	$('#link_pager a').each(function(){










I then used the ajax variable to determine what I need to output, using renderPartial if the ajax get variable is present.

here is the Ajax function, on click on pagination link, you can hit the url by this way…:)

$("ul#clinkPageId li a").on('click',function (e){




and here the ajax way to render data

function loadlistData(url)

 {//show loader.


    var search = $('#search').val();

    var url = url || '<?php echo Yii::app()->createUrl('admin/controller/action')?>';

    $.ajax({type:"POST", url:url,data:{'search':search},success:function(data){


           $('#subcategoryMsg').html('<?php echo  (Yii::app()->user->hasFlash('success')) ? Yii::app()->user->getFlash('success') : ''?>');



here is controller action define

public function actionSubCategoryList()






            $criteria->order = 'column';

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