2017 © Pedro Peláez
 

yii2-extension yii2-separatedpager

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

image

justinvoelker/yii2-separatedpager

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

  • Saturday, May 30, 2015
  • by justinvoelker
  • Repository
  • 4 Watchers
  • 18 Stars
  • 6,469 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

Separated Pager for Yii2

A Yii2 LinkPager that displays the first and last pages inline with other pages., (*1)

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., (*2)

sample, (*3)

Installation

Install the extension

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

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

or add, (*6)

"justinvoelker/yii2-separatedpager": "*"

to the require section of your composer.json file., (*7)

Usage

Simply add the pager property to your GridView and reference this class, (*8)

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., (*9)

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 ...., (*10)

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

    '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)., (*12)

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., (*13)

The Versions

30/05 2015

dev-master

9999999-dev

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

  Sources   Download

BSD-3-Clause

The Requires

 

by Justin Voelker

yii2 pagination linkpager

30/05 2015

1.0.2

1.0.2.0

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

  Sources   Download

BSD-3-Clause

The Requires

 

by Justin Voelker

yii2 pagination linkpager

21/02 2015

1.0.1

1.0.1.0

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

  Sources   Download

BSD-3-Clause

The Requires

 

by Justin Voelker

yii2 pagination linkpager

21/02 2015

1.0.0

1.0.0.0

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

  Sources   Download

BSD-3-Clause

The Requires

 

by Justin Voelker

yii2 pagination linkpager