View as Markdown

API reference: @salmonui/data-grid

DataGridViewApiinterface

import type { DataGridViewApi } from '@salmonui/data-grid';
interface DataGridViewApi {
    getViewport(): DataGridViewport;
    subscribeViewport(listener: () => void): () => void;
    getRowOffsets(): RowMetrics;
    scrollTo(options: DataGridScrollToOptions): void;
    getPageSizeForHeight(height: number): number;
}
DataGridViewApi members (5)
NameSignatureDescription
getViewportgetViewport(): DataGridViewport;

Scroll sync extension point: the current body viewport.

subscribeViewportsubscribeViewport(listener: () => void): () => void;

Calls listener outside React on every body scroll and layout change; returns the unsubscribe function.

getRowOffsetsgetRowOffsets(): RowMetrics;

Row height extension point: the row offsets of the visible row model (the body's own prefix sums).

scrollToscrollTo(options: DataGridScrollToOptions): void;

Scrolls the body to an offset. An omitted axis keeps its position; offsets are clamped to the scroll range.

getPageSizeForHeightgetPageSizeForHeight(height: number): number;

Whole data rows that fit in height px after the toolbar, group drop area, header rows, footer aggregate rows and pager; 0 when none fit. Rows count rowHeight (the estimate with measured rows, the card height in adaptive vertical mode). Before mount only the header and footer rows are subtracted.