clistview のページネーション スタイルを変更する方法。
デフォルトでは、Clistview は First Previous 1 2 3 4... Next Last を指定します。
しかし、ページネーションスタイルの前と最後のボタンのみが必要です。
この変更のために私は何をすべきですか?
clistview のページネーション スタイルを変更する方法。
デフォルトでは、Clistview は First Previous 1 2 3 4... Next Last を指定します。
しかし、ページネーションスタイルの前と最後のボタンのみが必要です。
この変更のために私は何をすべきですか?
createPageButtons
そのためには、yii フレームワークのクラスの関数を変更する必要がありCLinkPager
ます。そのためのショートカットや構成はありません。オーバーライドする新しいコンポーネントを作成する必要があります。または、これがプロジェクト全体の普遍的な要件である場合は、createPageButtons
このコードで「CLinkPager」の機能を変更できます。
protected function createPageButtons()
{
if(($pageCount=$this->getPageCount())<=1)
return array();
list($beginPage,$endPage)=$this->getPageRange();
$currentPage=$this->getCurrentPage(false); // currentPage is calculated in getPageRange()
$buttons=array();
// first page
$buttons[]=$this->createPageButton($this->firstPageLabel,0,$this->firstPageCssClass,$currentPage<=0,false);
// prev page
if(($page=$currentPage-1)<0)
$page=0;
$buttons[]=$this->createPageButton($this->prevPageLabel,$page,$this->previousPageCssClass,$currentPage<=0,false);
// next page
if(($page=$currentPage+1)>=$pageCount-1)
$page=$pageCount-1;
$buttons[]=$this->createPageButton($this->nextPageLabel,$page,$this->nextPageCssClass,$currentPage>=$pageCount-1,false);
// last page
$buttons[]=$this->createPageButton($this->lastPageLabel,$pageCount-1,$this->lastPageCssClass,$currentPage>=$pageCount-1,false);
return $buttons;
}