@jsvision/datagrid / GridDataSource
Interface: GridDataSource<T>
Defined in: datagrid/src/data-source.ts:22
The read/mutate seam the grid body binds to. In-memory and windowed/server sources implement this same shape, so the body is source-agnostic. Only rowKey/length/rowAt are exercised in the read-only foundation; the optional push-down and windowing members are declared for later releases.
rowAt returns undefined for an out-of-range or not-yet-loaded index (a windowed source may not have the row yet); an in-memory source always has every in-range row.
Type Parameters
T
T
Properties
rowKey
rowKey: (
row) =>string|number
Defined in: datagrid/src/data-source.ts:24
Stable identity for a row (required).
Parameters
row
T
Returns
string | number
Methods
complete()?
optionalcomplete():boolean
Defined in: datagrid/src/data-source.ts:58
Whether every row is loaded in memory. Omit it (or return true) for an eager in-memory source, so a footer aggregate renders a clean grand total. A windowed/server source that has loaded only part of the dataset returns false, and the footer labels its aggregates "(loaded)" — a total over the loaded set is never passed off as a whole-dataset grand total.
Returns
boolean
distinct()?
optionaldistinct(columnId):Promise<DistinctResult>
Defined in: datagrid/src/data-source.ts:51
Distinct formatted labels for a column, for value-list filtering (a later release). Returns the labels plus an optional truncated flag so a bounded/windowed source can disclose a capped list instead of silently under-reporting.
Parameters
columnId
string
Returns
Promise<DistinctResult>
ensureRange()?
optionalensureRange(start,end):void|Promise<void>
Defined in: datagrid/src/data-source.ts:41
Prefetch a window of rows (windowed sources; a later release).
Parameters
start
number
end
number
Returns
void | Promise<void>
insert()?
optionalinsert(row,at?):void|Promise<void>
Defined in: datagrid/src/data-source.ts:34
Insert a row at a source-array index (append when at is omitted). Optional — a source that omits it is read-only, so the grid can never add through it. The row must already carry its own rowKey (the caller owns key generation). A windowed/server source uses this callback to persist.
Parameters
row
T
at?
number
Returns
void | Promise<void>
length()
length():
number
Defined in: datagrid/src/data-source.ts:26
Total row count (best-known for a windowed source).
Returns
number
remove()?
optionalremove(keys):void|Promise<void>
Defined in: datagrid/src/data-source.ts:39
Remove rows by key. Optional — a source that omits it is read-only, so the grid can never delete through it. Keys not present are ignored. A windowed/server source uses this callback to persist.
Parameters
keys
readonly Key[]
Returns
void | Promise<void>
revision()?
optionalrevision():number
Defined in: datagrid/src/data-source.ts:67
A reactive revision counter for a windowed/async source: the grid reads it inside its display derivation, so a bump (a fetched window has landed) re-derives the display and repaints the newly-loaded rows. It must be a tracked signal read (e.g. the getter of a signal<number>), not a plain counter — a non-reactive read never subscribes, so the grid would never repaint on resolve. Omit it for an eager in-memory source (its rows signal already drives repaint); the grid's read is then inert.
Returns
number
rowAt()
rowAt(
index):T|undefined
Defined in: datagrid/src/data-source.ts:28
The row at a display-ordered index, or undefined when out of range / not yet loaded.
Parameters
index
number
Returns
T | undefined
setFilter()?
optionalsetFilter(model):void
Defined in: datagrid/src/data-source.ts:45
Push filtering down to the source; omit for client-side filtering (a later release).
Parameters
model
Returns
void
setSort()?
optionalsetSort(keys):void
Defined in: datagrid/src/data-source.ts:43
Push sort down to the source; omit for client-side sorting (a later release).
Parameters
keys
SortKey[]
Returns
void