PHP Класс kop\y2sp\ScrollPager

ScrollPager works with a [[Pagination]] object which specifies the totally number of pages and the current page number.
Example usage: echo ListView::widget([ 'dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'itemView' => '_item_view', 'pager' => ['class' => \kop\y2sp\ScrollPager::className()] ]); This widget is using {@link http://infiniteajaxscroll.com/ JQuery Infinite Ajax Scroll plugin}.
Автор: Ivan Koptiev ([email protected])
Наследование: extends yii\base\Widget
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$container string Enter the selector of the element containing your items that you want to paginate.
$delay integer Minimal number of milliseconds to stay in a loading state.
$enabledExtensions array The list of the enabled plugin extensions.
$eventOnLoad string | yii\web\JsExpression Triggered when a new url will be loaded from the server.
$eventOnLoaded string | yii\web\JsExpression Triggered after a new page was loaded from the server.
$eventOnNext string | yii\web\JsExpression 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.
$eventOnNoneLeft string | yii\web\JsExpression Triggered when there are no more pages left.
$eventOnPageChange string | yii\web\JsExpression Triggered when a used scroll to another page.
$eventOnReady string | yii\web\JsExpression Triggered when IAS and all the extensions have been initialized.
$eventOnRender string | yii\web\JsExpression Triggered before new items will be rendered.
$eventOnRendered string | yii\web\JsExpression Triggered after new items have rendered. Note: This event is only fired once.
$eventOnScroll string | yii\web\JsExpression Triggered when the visitors scrolls.
$historyPrev string Enter 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.
$item string Enter the selector of the element that each item has. Make sure the elements are inside the container element.
$negativeMargin integer
$next string Enter 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.
$noneLeftTemplate string Allows you to override the "nothing left" message html template.
$noneLeftText string Text of the "nothing left" message. Default: "You reached the end".
$overflowContainer string A selector for "div" HTML element to use as an overflow container.
$pagination The pagination object that this pager is associated with. You must set this property in order to make ScrollPager work.
$paginationSelector string Enter the selector of the element containing the pagination.
$spinnerSrc string The src attribute of the spinner image.
$spinnerTemplate string Allows you to override the spinner html template.
$triggerOffset integer The number of pages which should load automatically. After that the trigger is shown for every subsequent page.

For 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.
$triggerTemplate string Allows you to override the trigger html template.
$triggerText string Text of trigger the link. Default: "Load more items".

Открытые методы

Метод Описание
init ( ) Initializes the pager.
run ( ) : mixed Executes the widget.

Защищенные методы

Метод Описание
checkEnabledExtensions ( string | array $extensions ) : boolean Check whether the given extensions are enabled.
registerAssets ( ) Register required asset bundles.
registerEventHandlers ( array $config ) Register jQuery IAS event handlers.
registerExtensions ( array $config ) Register jQuery IAS extensions.

Описание методов

checkEnabledExtensions() защищенный Метод

Check whether the given extensions are enabled.
protected checkEnabledExtensions ( string | array $extensions ) : boolean
$extensions string | array Single or multiple extensions names.
Результат boolean Operation result.

init() публичный Метод

Initializes the pager.
public init ( )

registerAssets() защищенный Метод

You can override this method in case if you want to use your own JQuery Infinite Ajax Scroll plugin files (for example, some forked plugin version).
protected registerAssets ( )

registerEventHandlers() защищенный Метод

This method takes jQuery IAS event handlers definition as a parameter and registers this event handlers.
protected registerEventHandlers ( array $config )
$config array jQuery IAS event handlers definition.

registerExtensions() защищенный Метод

This method takes jQuery IAS extensions definition as a parameter and registers this extensions.
protected registerExtensions ( array $config )
$config array jQuery IAS extensions definition.

run() публичный Метод

This overrides the parent implementation by initializing jQuery IAS and displaying the generated page buttons.
public run ( ) : mixed
Результат mixed

Описание свойств

$container публичное свойство

Enter the selector of the element containing your items that you want to paginate.
public string $container
Результат string

$delay публичное свойство

Minimal number of milliseconds to stay in a loading state.
public int $delay
Результат integer

$enabledExtensions публичное свойство

The list of the enabled plugin extensions.
public array $enabledExtensions
Результат array

$eventOnLoad публичное свойство

Triggered when a new url will be loaded from the server.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnLoad
Результат string | yii\web\JsExpression

$eventOnLoaded публичное свойство

Triggered after a new page was loaded from the server.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnLoaded
Результат string | yii\web\JsExpression

$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.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnNext
Результат string | yii\web\JsExpression

$eventOnNoneLeft публичное свойство

Triggered when there are no more pages left.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnNoneLeft
Результат string | yii\web\JsExpression

$eventOnPageChange публичное свойство

Triggered when a used scroll to another page.
См. также: http://infiniteajaxscroll.com/docs/extension-paging.html
public string|JsExpression,yii\web $eventOnPageChange
Результат string | yii\web\JsExpression

$eventOnReady публичное свойство

Triggered when IAS and all the extensions have been initialized.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnReady
Результат string | yii\web\JsExpression

$eventOnRender публичное свойство

Triggered before new items will be rendered.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnRender
Результат string | yii\web\JsExpression

$eventOnRendered публичное свойство

Triggered after new items have rendered. Note: This event is only fired once.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnRendered
Результат string | yii\web\JsExpression

$eventOnScroll публичное свойство

Triggered when the visitors scrolls.
См. также: http://infiniteajaxscroll.com/docs/events.html
public string|JsExpression,yii\web $eventOnScroll
Результат string | yii\web\JsExpression

$historyPrev публичное свойство

Enter 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.
public string $historyPrev
Результат string

$item публичное свойство

Enter the selector of the element that each item has. Make sure the elements are inside the container element.
public string $item
Результат string

$negativeMargin публичное свойство

public int $negativeMargin
Результат integer

$next публичное свойство

Enter 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.
public string $next
Результат string

$noneLeftTemplate публичное свойство

Allows you to override the "nothing left" message html template.
public string $noneLeftTemplate
Результат string

$noneLeftText публичное свойство

Text of the "nothing left" message. Default: "You reached the end".
public string $noneLeftText
Результат string

$overflowContainer публичное свойство

A selector for "div" HTML element to use as an overflow container.
См. также: http://infiniteajaxscroll.com/examples/overflow.html
public string $overflowContainer
Результат string

$pagination публичное свойство

The pagination object that this pager is associated with. You must set this property in order to make ScrollPager work.
public $pagination

$paginationSelector публичное свойство

Enter the selector of the element containing the pagination.
public string $paginationSelector
Результат string

$spinnerSrc публичное свойство

The src attribute of the spinner image.
public string $spinnerSrc
Результат string

$spinnerTemplate публичное свойство

Allows you to override the spinner html template.
public string $spinnerTemplate
Результат string

$triggerOffset публичное свойство

The number of pages which should load automatically. After that the trigger is shown for every subsequent page.

For 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.
public int $triggerOffset
Результат integer

$triggerTemplate публичное свойство

Allows you to override the trigger html template.
public string $triggerTemplate
Результат string

$triggerText публичное свойство

Text of trigger the link. Default: "Load more items".
public string $triggerText
Результат string