RevGrid - v0.9.3
    Preparing search index...

    Interface used by client to get data from a server

    interface RevDataServer<SF extends RevSchemaField> {
        fetchViewData(
            rectangles: readonly RevRectangle[],
            callback?: (failure: boolean) => void,
        ): void;
        getCursorName(field: SF, rowIndex: number): string;
        getEditValue(field: SF, rowIndex: number): unknown;
        getRowCount(): number;
        getRowIdFromIndex(rowIndex: number): unknown;
        getRowIndexFromId(rowId: unknown): undefined | number;
        getTitleText(field: SF, rowIndex: number): string;
        getViewData(metadataFieldName?: string): readonly ViewRow[];
        getViewRow(rowIndex: number): ViewRow;
        getViewValue(field: SF, rowIndex: number): unknown;
        setEditValue(field: SF, rowIndex: number, value: unknown): void;
        setViewRow(rowIndex: number, dataRow: ViewRow): void;
        subscribeDataNotifications(client: RevDataServer.NotificationsClient): void;
        unsubscribeDataNotifications(
            client: RevDataServer.NotificationsClient,
        ): void;
    }

    Type Parameters

    Implemented by

    Index

    Methods

    • Used to Prefetch data

      Parameters

      • rectangles: readonly RevRectangle[]

        Unordered list of rectangular regions of cells to fetch in a single (atomic) operation.

      • Optionalcallback: (failure: boolean) => void

        Optional callback. If provided, implementation calls it with false on success (requested data fully fetched) or true on failure.

      Returns void

      Tells dataModel what cells will be needed by subsequent calls to RevDataServer#getViewValue. This helps remote or virtualized data models fetch and cache data. If your data model doesn't need to know this, don't implement it.

    • Cursor to be displayed when mouse hovers over cell containing data point

      Parameters

      • field: SF
      • rowIndex: number

      Returns string

    • Get a field's value at the specified row in a format suitable for editing.

      Parameters

      • field: SF

        The field from which to get the value

      • rowIndex: number

        The index of the row from which to get the value

      Returns unknown

      The value of the field at the specified row.

      This function only needs to be implemented if cells can be edited. See RevCellEditor for more information about editing data. The core of the client does not need to know the type of the return value. getEditValue() is called by the Cell Editor associated with the cell. A cell editor expects a certain type of view value and casts the result accordingly.

    • The current count of rows data in the server.

      Returns number

      Number of data rows.

    • IMPLEMENTATION OF THIS METHOD IS OPTIONAL.

      Only called by Hypergrid when it receives the data-prereindex or data-postreindex events. These events are typically triggered before and after data model remaps the rows (in its apply method).

      Parameters

      • rowIndex: number

        Grid row index.

      Returns unknown

      Unique Id of row specified by rowIndex.

    • Parameters

      • rowId: unknown

      Returns undefined | number

    • Title text to be displayed when mouse hovers over cell containing data point

      Parameters

      • field: SF
      • rowIndex: number

      Returns string

    • IMPLEMENTATION OF THIS METHOD IS OPTIONAL.

      All grid data.

      Parameters

      • OptionalmetadataFieldName: string

        If provided, the output will include the row metadata object in a "hidden" field with this name.

      Returns readonly ViewRow[]

      All the grid's data rows.

    • IMPLEMENTATION OF THIS METHOD IS OPTIONAL.

      Get a row of data.

      The injected default implementation is an object of lazy getters.

      Parameters

      • rowIndex: number

      Returns ViewRow

      The data row corresponding to the given rowIndex. If row does not exist, then throw error.

    • Get a field's value at the specified row in a format suitable for display.

      Parameters

      • field: SF

        The field from which to get the value

      • rowIndex: number

        The index of the row from which to get the value

      Returns unknown

      The value of the field at the specified row.

      The core of the client does not need to know the type of the return value. getViewValue() is called by the Cell Painter associated with the cell/subgrid. The cell painter expects a certain type of view value and casts the result accordingly.

    • IMPLEMENTATION OF THIS METHOD IS OPTIONAL.

      Set a cell's value given its column schema & row indexes and a new value.

      Parameters

      • field: SF
      • rowIndex: number
      • value: unknown

      Returns void

    • IMPLEMENTATION OF THIS METHOD IS OPTIONAL.

      Update a row in place, without deleting the row (and without affecting succeeding rows' indexes).

      Parameters

      • rowIndex: number
      • dataRow: ViewRow

        Updated row value

      Returns void