API Docs for: 1.0.0
Show:

eZ.LoadMorePagination Class

View extension providing a pagination based on a load more button. A Load More Pagination view can render and append an item view per new item added in the items attribute. The view output should provide an element with the class ez-loadmorepagination-more, when the user taps on its element, the offset attribute is incremented by limit value. The view is free to handle that event in its own way but this extension is primarily design to be used with the eZ.AsynchronousView extension. It also handles a loading state which result in the is-page-loading class to be added/removed from the view container. The extension also expects the rendered view to have the following elements:

  • an element with the class ez-loadmorepagination-content where the item view containers are added
  • an element with the class ez-loadmorepagination-more-count where the remaing number of element to load is displayed
  • an element with the class ez-loadmorepagination-display-count where the number of currently displayed element is shown.

When a View is extended with this extension, it should define the following properties:

  • _getExpectedItemsCount a function that should return the number of expected items in total
  • _ItemViews a constructor function to build the View items
  • _itemViewBaseConfig the base configuration to pass the item views. This object will be merged with the item object and will be passed to the item view.

Methods

_appendItems

(
  • newItems
)
deprecated protected

Appends a rendered item view for the last loaded items.

Parameters:

  • newItems Array

_countLoadedItems

() Number protected

Counts the number of loaded and displayed items.

Returns:

_destroyItemViews

() private

Destroys the item views

_disableLoadMore

() protected

Disables the load more button

_enableLoadMore

() protected

Enables the load more button

_getItemViewConfig

(
  • struct
)
Object private

Returns the item view configuration for the given struct. It mixes the view configuration, the base item view configuration and the struct.

Parameters:

  • struct Object

Returns:

Object:

_getLoadMore

() Y.Node protected

Returns the load more button

Returns:

Y.Node:

_getNewlyAddedItems

(
  • itemNewVal
  • itemPrevVal
)
private

Return an array containing the items that we want to append in the view.

Parameters:

  • itemNewVal Array

    an array containing the new items.

  • itemPrevVal Array

    an array containing the old items.

_loadMore

() protected

tap event handler on the load more button.

_uiPageEndLoading

() protected

Removes the loading state of the UI

_uiPageLoading

() protected

Sets the UI in the loading the state

_uiUpdatePagination

() protected

Updates the pagination displayed to the editor.

_updateDisplayedCount

() protected

Updates the display count with the number of currently loaded subitems.

_updateMoreCount

() protected

Updates the more count in the load more button.

Properties

_getExpectedItemsCount

Function protected

Holds a function returning the number of items the view is supposed to display

_gridItemViews

Array deprecated protected

Holds the grid item view instances for the current grid. This property is deprecated and will be removed in PlatformUI 2.0, please use this._itemViews instead.

_ItemView

Function protected

Holds the View constructor to use to render each item.

_itemViewBaseConfig

Object protected

Holds the base configuration object for the item view. This object will be merged with the item object and the resulting object is used as the configuraton for the item view instance.

_itemViews

Array protected

Holds the item view instances

Attributes

items

Array

The items to display

limit

Number

The max number of the Locations to display per 'show more' session

Default: 10

loading

Boolean readonly

Indicates the whether the subitem list is currently in loading.

offset

Number

The offset in the Location list. A value below zero means no loading has been made yet.

Default: minus the limit