Sort (Product Listing Engine)
Sort (Product Listing Engine)
This is for:
DeveloperMethods
isSortedBy
Verifies whether the specified sort criterion is the currently active one.
Parameters
-
criterion:
SortByRelevance | SortByFields
The sort criterion to evaluate.
Returns boolean
: true
if the specified sort criterion is the currently active one; false
otherwise.
sortBy
Updates the sort criterion and executes a new query.
Parameters
-
criterion:
SortByRelevance | SortByFields
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
-
sort:
SortByRelevance | SortByFields
The current sort criterion.
Initialize
buildSort
Creates a Sort
controller instance for the product listing.
Parameters
-
engine:
ProductListingEngine
The headless engine.
-
props:
ProductListingSortProps
The configurable
Sort
controller properties.
Returns ProductListingSort
ProductListingSortProps
The configurable Sort
controller properties.
Properties
-
initialState?:
ProductListingSortInitialState
The initial state that should be applied to this
Sort
controller.
ProductListingSortInitialState
The initial state that should be applied to this Sort
controller.
Properties
-
criterion?:
SortByRelevance | SortByFields
The initial sort criterion to register in state.
Related Types
Unsubscribe
Call signatures
-
(): void;