Using the Yii framework:
I'm trying to implement CPagination with Ajax. The reason why is the page (that has the pagination) is being loaded as a Ajax return function(data) into a div status like $("div#status).html(data). I'm using renderPartial to load the view that has the pagination. The pagination works, but its not in ajax. I want it to do it in ajax and return the results into $(div#status)
Thanks, mnouh
I just created a new Pager widget, by extending CLinkPager. After extending I override one of its methods, and switched CHtml::link to CHtml:: ajaxLink.
<?php
class MoPager extends CLinkPager {
protected function createPageButton($label, $page, $class, $hidden, $selected) {
//parent::createPageButton($label, $page, $class, $hidden, $selected);
if($hidden || $selected)
$class.=' '.($hidden ? self::CSS_HIDDEN_PAGE : self::CSS_SELECTED_PAGE);
return '<li class="'.$class.'">'.CHtml::ajaxLink($label,$this->createPageUrl($page), array('success'=>'js:function(data) {
jQuery("div#info").html(data);}'), array('live'=> false)).'</li>';
}
}
?>