2017 © Pedro Peláez
 

yii2-extension yii2-scroll-pager

Infinite AJAX scrolling for Yii2 ListView widget

image

badaboom/yii2-scroll-pager

Infinite AJAX scrolling for Yii2 ListView widget

  • Saturday, June 9, 2018
  • by badaboom
  • Repository
  • 1 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 56 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

Yii2 Scroll Pager

Yii2 Scroll Pager (Y2SP) turns your regular paginated page into an infinite scrolling page using AJAX., (*1)

Y2SP works with a Pagination object which specifies the totally number of pages and the current page number., (*2)

Pager is build with help of JQuery Infinite Ajax Scroll plugin., (*3)

Latest Stable Version Code Climate Scrutinizer Code Quality Dependency Status License, (*4)

Requirements

  • Yii 2.0
  • PHP 5.4

Installation

The preferred way to install this extension is through Composer., (*5)

Either run, (*6)

php composer.phar require kop/yii2-scroll-pager "dev-master", (*7)

or add, (*8)

"kop/yii2-scroll-pager": "dev-master", (*9)

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

Usage

Just pass the ScrollPager class name to the ListView pager configuration. Make sure that items in your list have some classes that can be used as JavaScript selectors., (*11)

ListView

echo ListView::widget([
     'dataProvider' => $dataProvider,
     'itemOptions' => ['class' => 'item'],
     'itemView' => '_item_view',
     'pager' => ['class' => \badaboom\y2sp\ScrollPager::className()]
]);

GridView

echo GridView::widget([
     'dataProvider' => $dataProvider,
     'pager' => [
        'class' => \badaboom\y2sp\ScrollPager::className(),
        'container' => '.grid-view tbody',
        'item' => 'tr',
        'paginationSelector' => '.grid-view .pagination',
        'triggerTemplate' => '<tr class="ias-trigger"><td colspan="100%" style="text-align: center"><a style="cursor: pointer">{text}</a></td></tr>',
     ],
]);

Configuration

General Options

Option name Description Default value
container The selector of the element containing your items that you want to paginate. .list-view
item The selector of the element that each item has.<br Make sure the elements are inside the container element. .item
paginationSelector The selector of the element containing the pagination. .list-view .pagination
next The selector of the link element that links to the next page.
The href attribute of this element will be used to get the items from the next page.
Make sure there is only one(1) element that matches the selector.
.next a
delay Minimal number of milliseconds to stay in a loading state. 600
negativeMargin By default IAS starts loading new items when you scroll to the latest .item element.
The negativeMargin will be added to the items offset, giving you the ability to load new items earlier (please note that the margin is always transformed to a negative integer).

Example: Setting a negativeMargin of 250 means that IAS will start loading 250 pixel before the last item has scrolled into view.
10

Extensions

Option name Description Default value
enabledExtensions The list of the enabled plugin extensions. [
ScrollPager::EXTENSION_TRIGGER,
ScrollPager::EXTENSION_SPINNER,
ScrollPager::EXTENSION_NONE_LEFT,
ScrollPager::EXTENSION_PAGING,
ScrollPager::EXTENSION_HISTORY
]

Extension Options

Option name Description Default value
triggerText Text of trigger the link. Load more items
triggerTemplate Allows you to override the trigger html template. <div class="ias-trigger" style="text-align: center; cursor: pointer;"><a>{text}</a></div>
triggerOffset The number of pages which should load automatically. After that the trigger is shown for every subsequent page.

Example: if you set the offset to 2, the pages 2 and 3 (page 1 is always shown) would load automatically and for every subsequent page the user has to press the trigger to load it.
0
spinnerSrc The src attribute of the spinner image. Spinner Image
spinnerTemplate Allows you to override the spinner html template. <div class="ias-spinner" style="text-align: center;"><img src="{src}"/></div>
noneLeftText Text of the "nothing left" message. You reached the end
noneLeftTemplate Allows you to override the "nothing left" message html template. <div class="ias-noneleft" style="text-align: center;">{text}</div>
historyPrev The selector of the link element that links to the previous page.
The href attribute of this element will be used to get the items from the previous page.
Make sure there is only one element that matches the selector.
.previous
overflowContainer A selector for div HTML element to use as an overflow container. null

Plugin Events

Option name Description Default value
eventOnScroll Triggered when the visitors scrolls. null
eventOnLoad Triggered when a new url will be loaded from the server. null
eventOnLoaded Triggered after a new page was loaded from the server. null
eventOnRender Triggered before new items will be rendered. null
eventOnRendered Triggered after new items have rendered. null
eventOnNoneLeft Triggered when there are no more pages left. null
eventOnNext Triggered when the next page should be loaded.
Happens before loading of the next page starts. With this event it is possible to cancel the loading of the next page.
You can do this by returning false from your callback.
null
eventOnReady Triggered when IAS and all the extensions have been initialized. null
eventOnPageChange Triggered when a used scroll to another page. null

Report

License

yii2-scroll-pager is released under the MIT License. See the bundled LICENSE.md for details., (*12)

Resources

The Versions

09/06 2018

dev-master

9999999-dev http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

09/06 2018

2.5.1

2.5.1.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

06/07 2016

2.5.0

2.5.0.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

03/04 2016

2.4.1

2.4.1.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

29/03 2016

2.4.0

2.4.0.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

19/10 2015

2.3.1

2.3.1.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

13/08 2015

2.3.0

2.3.0.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

18/04 2015

2.2.4

2.2.4.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

01/03 2015

2.2.3

2.2.3.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

15/02 2015

2.2.2

2.2.2.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

23/10 2014

v2.2.1

2.2.1.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

20/10 2014

v2.2

2.2.0.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

05/08 2014

2.1.4

2.1.4.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

31/07 2014

v2.1.3

2.1.3.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

30/07 2014

v2.1.2

2.1.2.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

06/06 2014

v2.1.1

2.1.1.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling

04/04 2014

v1.0.2

1.0.2.0 http://kop.github.io/yii2-scroll-pager/

Infinite AJAX scrolling for Yii2 ListView widget

  Sources   Download

MIT

The Requires

 

by Ivan Koptiev

yii2 yii pagination pager scroll scrolling