Pagination
Methods
destroy
pagination.destroy()
Destroys the plugin instance.
disablePlugin
pagination.disablePlugin()
Disables the plugin functionality for this Handsontable instance.
enablePlugin
pagination.enablePlugin()
Enables the plugin functionality for this Handsontable instance.
firstPage
pagination.firstPage()
Switches the page to the first one.
getCurrentPage
pagination.getCurrentPage() ⇒ number
Returns the current 1-based page index from internal pagination state.
Returns: number - Current page (at least 1).
getCurrentPageData
pagination.getCurrentPageData() ⇒ Array<Array>
Gets the visual data for the current page. The returned data may be longer than the defined page size as the data may contain hidden rows (rows that are not rendered in the table).
Returns: Array<Array> - Returns the data for the current page.
getCurrentPageSize
pagination.getCurrentPageSize() ⇒ number | ‘auto’
Returns the current page size from internal pagination state. May be 'auto'.
Returns: number | 'auto' - Current page size or 'auto'.
getPaginationData
pagination.getPaginationData() ⇒ Object
Gets the pagination current state. Returns an object with the following properties:
currentPage: The current page number.totalPages: The total number of pages.pageSize: The page size.pageSizeList: The list of page sizes.autoPageSize: Whether the page size is calculated automatically.numberOfRenderedRows: The number of rendered rows.firstVisibleRowIndex: The index of the first visible row.lastVisibleRowIndex: The index of the last visible row.
hasNextPage
pagination.hasNextPage() ⇒ boolean
Checks, based on the current internal state, if there is a next page.
hasPreviousPage
pagination.hasPreviousPage() ⇒ boolean
Checks, based on the current internal state, if there is a previous page.
hidePageCounterSection
pagination.hidePageCounterSection()
Hides the page counter section in the pagination UI.
Emits: Hooks#event:afterPageCounterVisibilityChange
hidePageNavigationSection
pagination.hidePageNavigationSection()
Hides the page navigation section in the pagination UI.
Emits: Hooks#event:afterPageNavigationVisibilityChange
hidePageSizeSection
pagination.hidePageSizeSection()
Hides the page size section in the pagination UI.
Emits: Hooks#event:afterPageSizeVisibilityChange
isEnabled
pagination.isEnabled() ⇒ boolean
Checks if the plugin is enabled in the handsontable settings. This method is executed in Hooks#beforeInit
hook and if it returns true than the Pagination#enablePlugin method is called.
lastPage
pagination.lastPage()
Switches the page to the last one.
nextPage
pagination.nextPage()
Switches the page to the next one.
prevPage
pagination.prevPage()
Switches the page to the previous one.
resetPage
pagination.resetPage()
Resets the current page to the initial page (initialValue) defined in the settings.
resetPageSize
pagination.resetPageSize()
Resets the page size to the initial value (pageSize) defined in the settings.
resetPagination
pagination.resetPagination()
Resets the pagination state to the initial values defined in the settings.
revertPageSizeTo
pagination.revertPageSizeTo(previousPageSize)
Restores the page size after a failed external load.
Category: Pagination
| Param | Type | Description |
|---|---|---|
| previousPageSize | number 'auto' | Previous page size. |
revertPageTo
pagination.revertPageTo(previousPage)
Restores the page after a failed external load.
Category: Pagination
| Param | Type | Description |
|---|---|---|
| previousPage | number | Page to restore (1-based). |
setPage
pagination.setPage(pageNumber)
Allows changing the page for specified page number.
Emits: Hooks#event:beforePageChange, Hooks#event:afterPageChange
| Param | Type | Description |
|---|---|---|
| pageNumber | number | The page number to set (from 1 to N). If 0 is passed, it will be transformed to 1. |
setPageSize
pagination.setPageSize(pageSize)
Changes the page size for the pagination. The method recalculates the state based
on the new page size and re-renders the table. If 'auto' is passed, the plugin will
calculate the page size based on the viewport size and row heights to make sure
that there will be no vertical scrollbar in the table.
Emits: Hooks#event:beforePageSizeChange, Hooks#event:afterPageSizeChange
| Param | Type | Description |
|---|---|---|
| pageSize | number 'auto' | The page size to set. |
showPageCounterSection
pagination.showPageCounterSection()
Shows the page counter section in the pagination UI.
Emits: Hooks#event:afterPageCounterVisibilityChange
showPageNavigationSection
pagination.showPageNavigationSection()
Shows the page navigation section in the pagination UI.
Emits: Hooks#event:afterPageNavigationVisibilityChange
showPageSizeSection
pagination.showPageSizeSection()
Shows the page size section in the pagination UI.
Emits: Hooks#event:afterPageSizeVisibilityChange
updatePlugin
pagination.updatePlugin()
Updates the plugin state. This method is executed when Core#updateSettings is invoked.