Data snapshot
Save and restore source data from a specific point in time.
Call captureSnapshot('Before changes') in your app and retain its returned ID.
View code
Sample data included in the code · 6 rows
Usage guide
#Preserve order data before bulk edits for later comparison or restoration.
Integration steps
- Save data before an operation
Call captureSnapshot('Before changes') in your app and retain its returned ID.
- Compare after editing
After changing data, create another snapshot to compare the two points. Query the list to inspect names and timestamps.
- Review the restoration target
Have users confirm the target snapshot in your app, pass its ID to restoreSnapshot, and inspect the result. Restoration may affect subsequent edits.
Preserve a point-in-time data state for comparison or restoration.
Save state below stores view settings such as columns and filters. It is not a data snapshot button; this page has no separate snapshot action UI.
Useful terms
- Data snapshot
- A record of row data at a specific time.
- Grid state
- State containing view configuration such as columns, sorting, filters, and selection.
Key API examples
Application code that references the registered Grid element as grid.
const snapshot = await grid.captureSnapshot('Before changes');
console.log(snapshot, await grid.listSnapshots());API reference
#Other properties1
| Attribute / Property | Type / Default | Description |
|---|---|---|
| maxSnapshots | numberDefault: 20 | Cap on retained rowData snapshots (oldest evict first). |
Events2
| Events | Detail type | Description |
|---|---|---|
{ id: string; name: string; rowCount: number } | Fires when a rowData snapshot is captured. | |
{ id: string; name: string; rowCount: number } | Fires when a rowData snapshot is restored. |
Methods5
| Method / Arguments | Return type | Description |
|---|---|---|
| name?: string | Promise<string> | capture the current `rowData` as a named snapshot (a deep copy, immune to later edits) and return its id. A version bookmark, distinct from undo/redo. The list is bounded by `maxSnapshots` (oldest evict first). |
Promise<SnapshotMeta[]> | the retained snapshots, newest last, without their row payloads. | |
| id: string | Promise<boolean> | delete a snapshot by id; returns whether one was removed. |
| idA: string, idB?: string | Promise<SnapshotDiff<GridRow>> | diff snapshot `idA` → `idB` (added / removed / changed rows with per-field before/after). Omit `idB` to diff a snapshot against the CURRENT rowData. Rows match by `getRowId` (else `row.id`, else position). A missing id contributes an empty side. |
| id: string | Promise<boolean> | restore a snapshot: replace `rowData` with a fresh deep copy of the snapshot's rows (re-cloned so later edits don't taint the stored version) and emit `rowDataChanged` with the computed added / updated / removed (matched by getRowId) plus `snapshotRestored`. Returns false when the id is unknown. Undo/redo continues on top of the restored state. |
Explore each feature
Learn when to use each feature and how to configure it. Each guide identifies live examples and features you connect in your app.