Skip to content

DataSource@sheetwrite/core

On this page

Host callback that asynchronously loads cancellable rectangular pages.

Examples

import type { DataSource, RowData } from "@sheetwrite/core";
const rows: RowData[] = [{ amount: 12 }, { amount: 18 }];
capabilities: { protocol: 2, columns: "windowed" },
async getRows(request) {
request.signal.throwIfAborted();
return {
Object.fromEntries(request.columns.flatMap((band) =>
band.keys.map((key) => [key, row[key] ?? null])))),
};
},
};

See also

Members 2

capabilities
readonly capabilities: DataSourceCapabilities;
getRows Loads the requested rows and columns; implementations should stop work when its signal aborts.
getRows(request: DataSourceRequest): Promise<DataSourcePage>;

Declaration

View full TypeScript declaration
export interface DataSource {
readonly capabilities: DataSourceCapabilities;
getRows(request: DataSourceRequest): Promise<DataSourcePage>;
}

Referenced by

Workspace packages depending on @sheetwrite/core

  • @sheetwrite/benchdependency
  • @sheetwrite/docs-startdependency
  • @sheetwrite/reactdependency
  • @sheetwrite/sveltedependency
  • @sheetwrite/vuedependency
  • @sheetwrite/xlsxdependency

Public exports naming DataSource

Documentation