Analytics & Reports
Analytics

Sort

Ability to change the order of products returned in response. It has configuration settings.

Provided Aliases: $sort

Example

<gb-sort labels="{ ["price low to high", "price high to low", "relevance"] }"></gb-sort>

Properties

Property Type Required
labels Array of strings Yes

These are configurable via tags: read more under configuration.

Labels

An array of sort labels.

State

State Type Default
sorts { label: string, selected?: boolean }[] []
onSelect(index) function

sorts

An array of sort items. The selected key is only available on a sort item when it is set to true.

onSelect(index)

  • index: number - index of the selected sort

Sends an action to request the selected sort.

Events

Event Affected State Properties
'sorts_updated' sorts