Module: alfresco/lists/Paginator

alfresco/lists/Paginator

This module is intended to provide pagination controls for working with the AlfSortablePaginatedList (and its descendant widgets). It provides controls for selecting specific pages of data as well as navigating back and forward between specific pages of data. It provides the ability to select from a configurable array of page sizes.

If using with a AlfSortablePaginatedList it is important to ensure that the initial page size configured for the paginator matches that of the list to ensure they are initially in sync.

A compact mode is provided that only rendered the back and forward controls and omits the page size selection menu.

Author:
  • Dave Draper
License:
Source:

Examples

Basic configuration using default page sizes:

{
   "name": "alfresco/lists/Paginator"
}

Basic configuration using custom page sizes:

{
   "name": "alfresco/lists/Paginator",
   "config": {
      "documentsPerPage": 10,
      "pageSizes": [5,10,20]"
   }
}

Configuration for compact mode:

{
   "name": "alfresco/lists/Paginator",
   "config": {
      "compactMode": true
   }
}

Members

backLabel :string

The label for the page back menu item.
Type:
  • string
Since:
  • 1.0.64
Default Value:
  • "list.paginator.back.label"
Source:

compactMode :boolean

Indicates whether the paginator should be displayed in "compact" mode where only the back and forward buttons are displayed.
Type:
  • boolean
Default Value:
  • false
Source:

currentPage :number

Used to keep track of the current page number in the current data set
Type:
  • number
Default Value:
  • null
Source:

currentPageLabelStyle :string

The style of current page number. The default is "NUMBER" which indicates that just the page number should be displayed. The only alternative in the current version is "X_OF_Y" which will render the label in the form "1 of 4" (as in page 1 of 4).
Type:
  • string
Since:
  • 1.0.64
Default Value:
  • "NUMBER"
Source:

documentsPerPage :number

The number of documents to show per page.
Type:
  • number
Default Value:
  • 25
Source:

forwardLabel :string

The label for the page forward menu item.
Type:
  • string
Since:
  • 1.0.64
Default Value:
  • "list.paginator.next.label"
Source:

hideWhenLoading :boolean

This indicates whether or not the pagination controls should be hidden whilst data is being loaded.
Type:
  • boolean
Default Value:
  • false
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/Paginator.properties"}]
Source:

loadDataPublishScope :string

This is the scope that data requests are expected to be published on. It is the empty string by default as this is equivilent to the global scope. This is only used when hideWhenLoading is configured to be true.
Type:
  • string
Source:

loadDataPublishTopic :string

This is the topic that is expected to be published when data requests are made. This is only used when hideWhenLoading is configured to be true and is used to set up visibility configuration so that the pagination controls can be hidden on data load requests.
Type:
  • string
Default Value:
  • null
Source:

pageBackTopic :string

Type:
  • string
Default Value:
  • "ALF_PAGE_BACK"
Source:

pageForwardTopic :string

Type:
  • string
Default Value:
  • "ALF_PAGE_FORWARD"
Source:

pageSelector :object

This will be initialised to be a select menu for the current page.
Type:
  • object
Default Value:
  • null
Source:

pageSelectorGroup :object

This will be the group into which page selection item can be added.
Type:
  • object
Default Value:
  • null
Source:

pageSizePreferenceName :string

The name of the property to access in order to retrieve the page-size preference for this widget
Type:
  • string
Since:
  • 1.0.46
Default Value:
  • "org.alfresco.share.documentList.documentsPerPage"
Source:

pageSizes :array

This can be used to configure an array of page sizes that should be displayed in the paginator. If left as the default of null then an array will automatically created containing page sizes of 25, 50, 75 and 100. The array should be a simple list of numbers.
Type:
  • array
Default Value:
  • null
Source:

showPageSelector :boolean

Indicates whether or not the page selector menu should be displayed.
Type:
  • boolean
Since:
  • 1.0.64
Default Value:
  • true
Source:

startIndexProperty :string

The property in the response that indicates the starting index of overall data to request.
Type:
  • string
Default Value:
  • "startIndex"
Source:

totalPages :number

Used to keep track of the total number of pages in the current data set
Type:
  • number
Default Value:
  • null
Source:

totalRecords :number

Used to keep track of the total number of documents in the current data set
Type:
  • number
Default Value:
  • null
Source:

totalResultsProperty :string

The property in the response that indicates the total number of results available.
Type:
  • string
Default Value:
  • "totalRecords"
Source:

widgetsAfter :array

Since this widget is an implementation of an AlfMenuBar it is perfectly reasonable to add additional menu widgets (such as menu items or drop-down menus) after the main pagination controls. This can be configured to be an array of such menu widgets to be displayed.
Type:
  • array
Default Value:
  • null
Source:

widgetsBefore :array

Since this widget is an implementation of an AlfMenuBar it is perfectly reasonable to add additional menu widgets (such as menu items or drop-down menus) before the main pagination controls. This can be configured to be an array of such menu widgets to be displayed.
Type:
  • array
Default Value:
  • null
Source:

Methods

allWidgetsProcessed()

Handles the creation of the paginator widgets and creates references to some of them (such as the page back and forward controls, etc) so that they can be easily referenced in other functions.
Source:

checkAndUpdatePageSelectionMenu(position)

Handles initialization and necessary updates of the page selection menu items when the popup is opened.
Parameters:
Name Type Description
position object the position of the selection menu popup when opened
Since:
  • 1.0.82
Source:

createPageSizeMenuItem(pageSizeMenuItems, pageSize)

This function is called to create a new AlfCheckableMenuItem for each page size configured in the pageSizes array.
Parameters:
Name Type Description
pageSizeMenuItems array The array to add the new menu item to.
pageSize number The page size to add to create a menu item for.
Source:

hideControls(payload)

Hides all the pagination controls.
Parameters:
Name Type Description
payload object Any payload included with the publication (not required)
Source:

isValidPageSize(requestedPageSize)

Checks whether or not a particular page size is valid or not. A page size is valid if it is defined in the pageSizes array.
Parameters:
Name Type Description
requestedPageSize number The page size to check for
Source:

onDocumentsLoaded(payload)

Parameters:
Name Type Description
payload object The details of the documents that have been loaded
Source:

onDocumentsPerPageChange(payload)

Handles updates to the number of documents to display per page. The documents to display per page will only be updated if the requested value is present in the pageSizes array.
Parameters:
Name Type Description
payload object
Source:

onPageBack(payload)

Handles requests to go back a page.
Parameters:
Name Type Description
payload object
Source:
Fires:

onPageForward(payload)

Handles requests to go forward a page.
Parameters:
Name Type Description
payload object
Source:
Fires:

postCreate()

Calls the createPageSizeMenuItem function for each item in the pageSizes array to build the page size selection menu. If a pageSizes array has not been configured then it will create a default array containing the sizes 25,50,75 and 100.

It then constructs a widget model containing the menus and buttons that provide the pagination controls

Source:

postMixInProperties()

Source:
Listens to Events:

processLoadedDocuments(payload)

This function processes the loaded document data to set the appropriate data in the paginator widgets.
Parameters:
Name Type Description
payload object The data to use to update the widgets
Source: