项目作者: zhuravljov

项目描述 :
Stored sort, stored page size, and page size widget.
高级语言: PHP
项目地址: git://github.com/zhuravljov/yii2-pagination.git
创建时间: 2017-10-17T08:19:46Z
项目社区:https://github.com/zhuravljov/yii2-pagination

开源协议:BSD 3-Clause "New" or "Revised" License

下载


Yii2 Pagination Widgets

Latest Stable Version
Total Downloads

Installation

The preferred way to install the extension is through composer.
Add to the require section of your composer.json file:

  1. "zhuravljov/yii2-pagination": "~1.0"

Usage

Way to add page size widget to each GridView and ListView of an application
using DI container definition:

  1. <?php
  2. return [
  3. 'container' => [
  4. 'definitions' => [
  5. \yii\widgets\LinkPager::class => \zhuravljov\yii\pagination\LinkPager::class,
  6. ],
  7. ],
  8. ];

Advanced container configuration of LinkPager and LinkSizer widgets:

  1. <?php
  2. return [
  3. 'container' => [
  4. 'definitions' => [
  5. \yii\widgets\LinkPager::class => \zhuravljov\yii\pagination\LinkPager::class,
  6. \zhuravljov\yii\pagination\LinkPager::class => [
  7. 'maxButtonCount' => 5,
  8. ],
  9. \zhuravljov\yii\pagination\LinkSizer::class => [
  10. 'sizes' => [5, 10, 20, 50, 100],
  11. ],
  12. \yii\data\Pagination::class => [
  13. 'defaultPageSize' => 10,
  14. 'pageSizeLimit' => [1, 100],
  15. ],
  16. ],
  17. ],
  18. ];

There is StoredPagination to store page size that was selected before by user.
DI container definition looks like:

  1. <?php
  2. return [
  3. 'container' => [
  4. 'definitions' => [
  5. \yii\data\Pagination::class => \zhuravljov\yii\pagination\StoredPagination::class,
  6. ],
  7. ],
  8. ];

There is StoredSort to store selected sorting.
DI container definition looks like:

  1. <?php
  2. return [
  3. 'container' => [
  4. 'definitions' => [
  5. \yii\data\Sort::class => \zhuravljov\yii\pagination\StoredSort::class,
  6. ],
  7. ],
  8. ];