justinvoelker/yii2-separatedpager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

justinvoelker/yii2-separatedpager

最新稳定版本:1.0.2

Composer 安装命令:

composer require justinvoelker/yii2-separatedpager

包简介

A Yii2 LinkPager that displays the first and last pages inline with other pages.

README 文档

README

A Yii2 LinkPager that displays the first and last pages inline with other pages.

Rather than having dedicated "First" and "Last" buttons in your LinkPager, Separated Pager will show a standard set of page links but will also always include the first and last pages as the first and last page links. No more dedicated first/last buttons and no more guessing how many pages there are.

sample

Installation

Install the extension

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist justinvoelker/yii2-separatedpager "*" 

or add

"justinvoelker/yii2-separatedpager": "*" 

to the require section of your composer.json file.

Usage

Simply add the pager property to your GridView and reference this class

GridView::widget([ 'dataProvider' => $dataProvider, ... 'pager' => [ 'class' => 'justinvoelker\separatedpager\LinkPager', ] ]);

Please note that specifying less than 7 pages won't produce useful results. Less than 7 pages of content is acceptable (will look like the standard LinkPager) but limiting the pager to something less than 7 pages will look and work poorly. Five pages and the pager is almost worthless. Less than 5 and it is worthless.

Available Options

In addition to all of the standard LinkPager properties, one new property has been added, separator, that specifies a string to be used to indicate that multiple pages are being omitted. The default separator is ....

Here is my preferred pager setup. A max of 7 pages, 'Previous' and 'Next' buttons spelled out that are hidden on extra-small screens.

 'pager' => [ 'class' => 'justinvoelker\separatedpager\CustomLinkPager', 'maxButtonCount' => 7, 'prevPageLabel' => 'Previous', 'nextPageLabel' => 'Next', 'prevPageCssClass' => 'prev hidden-xs', 'nextPageCssClass' => 'next hidden-xs', 'activePageAsLink' => false, ]

Keep in mind that setting css classes will overwrite the defaults rather than appending to them. If additional classes should be included (such as the 'hidden-xs' above) the original prev and next should be included as well (this is the same way the standard LinkPager functions).

Standard LinkPager functionality uses a link for the active page. By setting activePageAsLink to false the link can be replaced with a span that looks the same but cannot be clicked.

统计信息

  • 总下载量: 70.37k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 31
  • 点击次数: 3
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 30
  • Watchers: 3
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固