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

    Interface IInsertableDatasource<T>

    A datasource that supports inserting items at a given index.

    Implement this interface when the datasource can accept new items (e.g. as the target of a cross-list drag-and-drop transfer). UI components use the isInsertableDatasource type guard to detect this capability.

    interface IInsertableDatasource<T = unknown> {
        getNumberOfItems(): number | Promise<number>;
        getObjectAtRowIndex(rowIndex: number): RowResult<T>;
        insertItem(index: number, item: T): 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.

    • Inserts item at index, shifting subsequent items to the right.

      After this call, getNumberOfItems() must return one more than before, and getObjectAtRowIndex(index) must return the inserted item.

      Parameters

      • index: number

        The zero-based position at which to insert.

      • item: T

        The item to insert.

      Returns void