It would be very helpful if the CLinkPager rendered the next and previous links (and the first and last page links) even if they were not meant to be visible (previous should not be visible on page one), and if the next, previous, first and last links all had a default css class. This would make it easier with jQuery to add ajax to the pager without the pager needing to be modified to support it - the javascript code can simply toggle the display:none when needed.
I've hacked on the CLinkPager class a bit. Changing the code in run() which adds the buttons to this:
if ($this->showFirstPageButton) $buttons[]=$this->createPageButton($this->firstPageLabel,0,$currentPage,"first",$beginPage>0); $buttons[]=$this->createPageButton($this->prevPageLabel,$currentPage-1,$currentPage,"prev",$currentPage>0); for($i=$beginPage;$i<=$endPage;++$i) $buttons[]=$this->createPageButton($i+1,$i,$currentPage); $buttons[]=$this->createPageButton($this->nextPageLabel,$currentPage+1,$currentPage,"next",$currentPage<$pageCount-1); if($this->showLastPageButton) $buttons[]=$this->createPageButton($this->lastPageLabel,$pageCount-1,$currentPage,"last",$endPage<$pageCount-1);
… and changing createPageButton() to this:
protected function createPageButton($label,$page,$currentPage,$class="",$visible=true) { $options=array(); if (!empty($class)) $options["class"] = $class; if (!$visible) $options["style"] = "display:none;"; if($page===$currentPage) return CHtml::tag("span", $options, $label); else return CHtml::tag("span", $options, CHtml::link($label,$this->createPageUrl($page))); }
… allows me to do this. Can this functionality be incorporated?