@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Interface ISortableDatasource<T>

    A datasource that supports server-side or in-memory sorting.

    interface ISortableDatasource<T = unknown> {
        getNumberOfItems(): number | Promise<number>;
        getObjectAtRowIndex(rowIndex: number): RowResult<T>;
        sortBy(expression: SortExpression<T> | null): void;
    }

    Type Parameters

    • T = unknown

      The row object type.

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Returns the total number of items, synchronously or asynchronously.

      Returns number | Promise<number>

    • Returns the row object at the given index.

      Parameters

      • rowIndex: number

        Zero-based index of the row to retrieve.

      Returns RowResult<T>

      The row value, or a Promise that resolves to it.

    • Applies the given sort expression to the datasource.

      The expression is a serializable array of { columnKey, direction } objects that can safely cross network boundaries (e.g. to a REST or GraphQL backend).

      Pass null to clear the current sort and restore the original order.

      Parameters

      • expression: SortExpression<T> | null

        One or more sort criteria in priority order, or null to clear.

      Returns void