Pager (Insight Engine)
Pager (Insight Engine)
This is for:
DeveloperThe Pager
controller allows to navigate through the different result pages.
Methods
isCurrentPage
Returns true
when the current page is equal to the passed page, and false
otherwise.
Parameters
-
page:
number
The page number to check.
Returns boolean
: Whether the passed page is selected.
nextPage
Updates the results to those on the next page.
previousPage
Updates the results to those on the previous page.
selectPage
Updates the results to those on the passed page.
Parameters
-
page:
number
The page number.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => void
A callback that’s invoked on state change.
Returns Unsubscribe
: A function to remove the listener.
Attributes
state
The state of the Pager controller.
Properties
-
currentPage:
number
The active page number.
-
currentPages:
number[]
The page range to display.
-
hasNextPage:
boolean
Returns
true
when a next page is available, andfalse
otherwise. -
hasPreviousPage:
boolean
Returns
true
when a previous page is available, andfalse
otherwise. -
maxPage:
number
The maximum available page.
Initialize
buildPager
Creates an insight Pager
controller instance.
Parameters
-
engine:
InsightEngine
The insight engine.
-
props:
PagerProps
The configurable
Pager
properties.
Returns Pager
PagerProps
The configurable Pager
properties.
Properties
-
initialState?:
PagerInitialState
The initial state that should be applied to the
Pager
controller. -
options?:
PagerOptions
The options for the
Pager
controller.
PagerInitialState
The initial state that should be applied to the Pager
controller.
Properties
-
page?:
number
The initial page number.
PagerOptions
The options for the Pager
controller.
Properties
-
numberOfPages?:
number
The number of pages to display in the pager.
Default:
5
Related Types
Unsubscribe
Call signatures
-
(): void;