View as Markdown

API reference: @salmonui/data/views

SavedViewsOptionsinterface

import type { SavedViewsOptions } from '@salmonui/data/views';

Also exported from @salmonui/data.

interface SavedViewsOptions<State extends DataGridState = DataGridState> {
    readonly gridId: string;
    readonly prefix?: string;
    readonly now?: () => number;
    readonly createId?: () => string;
    readonly migrate?: (record: Readonly<Record<string, unknown>>, schemaVersion: number) => SavedView<State> | null;
}
SavedViewsOptions members (5)
NameSignatureDescription
gridIdreadonly gridId: string;

The grid whose views these are (DataGrid id).

prefixoptionalreadonly prefix?: string;

Storage key prefix. Default salmonui:grid-views:.

nowoptionalreadonly now?: () => number;

Clock in epoch milliseconds. Default Date.now.

createIdoptionalreadonly createId?: () => string;

Id for a new view. Default crypto.randomUUID() when available, else a time-based counter.

migrateoptionalreadonly migrate?: (record: Readonly<Record<string, unknown>>, schemaVersion: number) => SavedView<State> | null;

Upgrades a stored record of an older (or unknown) record schema, or whose grid state needs upgrading; return null to drop it. Records of the current schema are passed through unchanged without calling it.