@coveo/headless-react
    Preparing search index...

    Interface Sort

    The Sort sub-controller lets you sort the products in a commerce interface.

    interface Sort {
        state: SortState;
        isAvailable(criterion: SortCriterion): boolean;
        isSortedBy(criterion: SortCriterion): boolean;
        sortBy(criterion: SortCriterion): void;
        subscribe(listener: () => void): Unsubscribe;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Verifies whether the specified sort criterion is available.

      Parameters

      Returns boolean

      true if the specified sort criterion is available; false otherwise.

    • Verifies whether the specified sort criterion is the currently active one.

      Parameters

      Returns boolean

      true if the specified sort criterion is the currently active one; false otherwise.

    • Updates the sort criterion and executes a new query.

      Parameters

      Returns void

    • 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.

    Properties

    state: SortState

    A scoped and simplified part of the headless state that is relevant to the Sort sub-controller.