Sort (Insight Engine)
Sort (Insight Engine)
The Sort
controller manages how the results are sorted.
Methods
isSortedBy
Checks whether the specified sort criterion matches the value in state.
Parameters
-
criterion:
SortCriterion | SortCriterion[]
The criterion to compare.
Returns boolean
: true
if the passed sort criterion matches the value in state, and false
otherwise.
sortBy
Updates the sort criterion and executes a new search.
Parameters
-
criterion:
SortCriterion | SortCriterion[]
The new sort criterion.
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
A scoped and simplified part of the headless state that is relevant to the Sort
controller.
Properties
-
sortCriteria:
string
The current sort criteria.
Initialize
buildSort
Creates an insight Sort
controller instance.
Parameters
-
engine:
InsightEngine
The insight engine.
-
props:
SortProps
The configurable
Sort
controller properties.
Returns Sort
SortProps
The configurable Sort
controller properties.
Properties
-
initialState?:
SortInitialState
The initial state that should be applied to this
Sort
controller.
SortInitialState
The initial state that should be applied to this Sort
controller.
Properties
-
criterion?:
SortCriterion | SortCriterion[]
The initial sort criterion to register in state.
Related Types
Unsubscribe
Call signatures
-
(): void