WarUI documentation

Stable row identity

experimental

Refresh and reorder product objects while keeping stable selected row IDs.

Live example

Expected behavior

Stable IDs preserve selection and focus through refresh. Index fallback tracks positions. A duplicate leaves the prior rows intact.

Source

const api = createGrid({ rows, columns, getRowId: row => row.sku });
api.setSelection(['SKU-02']);
api.setRows(rows.map(row => ({ ...row })));
console.log(api.getRowById('SKU-02')?.data);

API reference

GRID-A01-F06 API
KindNameTypeDescription
OptiongetRowId—Supplies a reusable logical ID, coerced to a string.
MethodgetRowById—Looks up a row node by ID in constant time.
MethodgetRowIndex—Returns the row’s source index or -1.
ErrorDuplicateRowIdError—Rejects a duplicate without replacing the previous rows.