Yii view operation-custom paging implementation method, yii view custom Paging
This article describes how to implement custom pages for Yii view operations. We will share this with you for your reference. The details are as follows:
1. The View File calls cgridview. The custom paging method is called during clistview.
<? Php $ this-> widget ('zii. widgets. grid. CGridView ', array ('id' => 'news-grid', 'dataprovider' => $ model-> search (), 'filter' => $ model, 'template' => '{items} {summary} {pager}', 'selectablerdones' => 2, 'pager' => 'zpager ', 'summarytext' => 'page number: {pages}/{page} page', 'columns '=> array ('class' => 'ccheckboxcolumn ', 'footer '=>' <button onclink = "deleteAll ()"> button </button> <button onclink = "refashAll ()"> button </button> ', 'footerhtmloptions '=> array ('colspan' => 5), 'selectablerdones' => 2,), 'id', array ('name' => 'title ', 'htmlopexception' => array ('width' => '000000'), 'value' => 'mb _ substr ($ data-> title, 20%, "UTF-8 ") ',), array ('name' => 'content', 'htmloptions' => array ('width' => '123 '), 'value' => 'mb _ substr (strip_tags ($ data-> content), "UTF-8") ',), array ('name' => 'type ', 'value' => 'news: model ()-> getNewsType ($ data-> type) ',), 'user ', array ('name' => 'status', 'value' => 'news: model ()-> getNewsStatus ($ data-> status )',), array ('class' => 'cbuttoncolumn', 'buttons' => array ('view' => array ('visable' => 'false '), // 'delete' => array ('click' => 'true '),),),),));
2. Copy Base-class paging files and make modifications to your paging Method
Copy framework/web/widgets/pagers/CListPager. php and change the name of the class to protected/components/zpager. php.
Framework/web/widgets/pagers/pager.css copy the corresponding style file to protected/components/css/pager.css
Modify the css loading directory of zpager. php
public static function registerCssFile($url=null){ if($url===null) $url=CHtml::asset(Yii::getPathOfAlias('application.components.css.pager').'.css'); Yii::app()->getClientScript()->registerCssFile($url);}
3. By modifying the Css style file, you can also modify the program that generates the list to modify the category.