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.
Item Index
Methods
Properties
Methods
_appendItems
-
newItems
Appends a rendered item view for the last loaded items.
Parameters:
-
newItems
Array
_destroyItemViews
()
private
Destroys the item views
_disableLoadMore
()
protected
Disables the load more button
_enableLoadMore
()
protected
Enables the load more button
_getItemViewConfig
-
struct
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:
_getLoadMore
()
Y.Node
protected
Returns the load more button
Returns:
_getNewlyAddedItems
-
itemNewVal
-
itemPrevVal
Return an array containing the items that we want to append in the view.
Parameters:
-
itemNewVal
Arrayan array containing the new items.
-
itemPrevVal
Arrayan 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
ArrayHolds 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
ArrayHolds the item view instances
Attributes
offset
Number
The offset in the Location list. A value below zero means no loading has been made yet.
Default: minus the limit