WillSetRowCallback
The WillSetRowCallback type describes a function that is called before a Row is set in the Store.
(
tableId: Id,
rowId: Id,
row: Row,
): Row | undefined| Type | Description | |
|---|---|---|
tableId | Id | |
rowId | Id | |
row | Row | The |
| returns | Row | undefined | The |
The callback receives the table Id, row Id, and the Row object that is about to be set. It can return the Row (possibly transformed) to allow the write, or undefined to prevent the Row from being set.
Multiple WillSetRowCallback functions can be registered and they will be called sequentially, the Row being updated successively. If any callback returns undefined, the chain short-circuits and the Row will not be set.
This callback fires both when setRow is called with a whole Row, and when setCell is called for a single Cell. When fired from setCell, the Row passed to the callback is a prospective row containing the existing Cell values merged with the new Cell value. The entire returned Row is then applied as though setRow had been called with it: cells present in the returned Row are written (each also passing through willSetCell), and cells absent from the returned Row that were present in the existing Row will be deleted. Return undefined to cancel the operation entirely.
Since
v8.0.0