Pager (Insight Engine) (Deprecated)
Pager (Insight Engine) (Deprecated)
|
|
Headless v1 has been deprecated. We recommend using the latest version of the Coveo Headless library. |
The 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:
numberThe 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:
numberThe page number.
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => voidA 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:
numberThe active page number.
-
currentPages:
number[]The page range to display.
-
hasNextPage:
booleanReturns
truewhen a next page is available, andfalseotherwise. -
hasPreviousPage:
booleanReturns
truewhen a previous page is available, andfalseotherwise. -
maxPage:
numberThe maximum available page.
Initialize
buildPager
Creates an insight Pager controller instance.
Parameters
-
engine:
InsightEngineThe insight engine.
-
props:
PagerPropsThe configurable
Pagerproperties.
Returns Pager
PagerProps
The configurable Pager properties.
Properties
-
initialState?:
PagerInitialStateThe initial state that should be applied to the
Pagercontroller. -
options?:
PagerOptionsThe options for the
Pagercontroller.
PagerInitialState
The initial state that should be applied to the Pager controller.
Properties
-
page?:
numberThe initial page number.
PagerOptions
The options for the Pager controller.
Properties
-
numberOfPages?:
numberThe number of pages to display in the pager.
Default:
5
Related types
Unsubscribe
Call signatures
-
(): void