Formula calculation PRO
Automate calculations with cell formulas and workbook connections.
For a developer-defined quantity × price calculation, the table's valueGetter is sufficient. Use formulas when users need to enter cell-reference expressions.
View code
Sample data included in the code · 6 rows
Usage guide
#Use formulas when users need to enter spreadsheet-style expressions referencing other cells.
Integration steps
- Choose the calculation approach
For a developer-defined quantity × price calculation, the table's valueGetter is sufficient. Use formulas when users need to enter cell-reference expressions.
- Prepare a formula input column
Enable formulas and provide cells accepting strings beginning with =. Define the arrangement of referenced rows and columns too.
- Change a referenced value
Enter a formula in your app and change a referenced cell. Inspect the result and formulaEvaluated or formulaError events.
Entered formulas are evaluated and results update when referenced data changes.
The current Total column uses valueGetter. This is not a formula-entry example for the numeric Quantity editor; workbook integration requires separate setup.
Useful terms
- A1 notation
- A cell reference using a column letter and row number.
- formulas
- A setting enabling evaluation of cell formulas beginning with =.
Using this feature in your product requires the Pro runtime and a valid license.
API reference
#Other properties5
| Attribute / Property | Type / Default | Description |
|---|---|---|
PRO | booleanDefault: false | Enable in-cell spreadsheet formulas. When `true`, a cell whose value is a string starting with `=` (e.g. `=SUM(A1:A3)`) is evaluated by the formula engine and the computed result is displayed. References are A1-style over `columnDefs` order (A = first column) × `rowData` order (row 1 = first row). Defaults to `false` — no behaviour change for grids that don't opt in. |
PRO showFormulas | booleanDefault: false | Show the formula text (`=…`) instead of the computed value in formula cells — the equivalent of Excel's "Show Formulas" (Ctrl+`). Useful for inspecting and verifying a sheet. Only meaningful when is `true`. |
PRO formulaBar | booleanDefault: false | show an Excel-style formula bar above the grid. It displays the active cell's raw content (the formula text for a formula cell) and edits it: Enter commits (and recalculates dependents), Escape reverts. Only meaningful with in the columnDefs API. |
PRO workbookId | stringDefault: undefined | workbook identity used for cross-grid formula coordination. `workbook-id` and must be supplied together while is enabled. Workbook ids are case-sensitive. |
PRO sheetName | stringDefault: undefined | case-insensitive sheet identity inside . Changing only this property renames the live registration without changing its numeric identity. |
Events5
| Events | Detail type | Description |
|---|---|---|
PRO | GridFormulaEvaluatedDetail | Fires when a formula cell is committed (only when `formulas` is enabled). |
PRO | GridFormulaErrorDetail | Fires alongside `formulaEvaluated` when the committed result is an error token. |
PRO | GridWorkbookBindingChangedDetail | a workbook sheet registration connected, renamed, or disconnected. |
PRO | GridWorkbookBindingErrorDetail | a rejected workbook/sheet input; the last valid binding is retained. |
PRO | SyGridWorkbookPropagationDetail | one event per affected SHEET per transaction: the generation/hash stamp riding the repaint. Fires from method, commit and enrollment contexts (never from render), so no parked-event flush is needed — the Phase F `componentDidRender` idiom applies to render-path emissions only. |
Methods11
| Method / Arguments | Return type | Description |
|---|---|---|
PRO | Promise<GridWorkbookBinding | null> | Current validated workbook/sheet registration, or null when opted out. |
PRO | Promise<GridWorkbookBinding | null> | Dispose and recreate the current registration using the public properties. |
PRO | Promise<boolean> | Explicitly leave the current workbook without changing public properties. |
PRO | Promise<SyGridWorkbookPropagationState> | the enrollment report: identity, the generation clock, this sheet's hub-registered cross-sheet formula cells, every registration REFUSAL (a refused cell keeps painting its engine-local value and will NOT propagate — this report is the truth surface for that divergence), and the last publication stamp. |
PRO | Promise<SyGridWorkbookFlushReport> | drain every scheduled workbook edit NOW . Commits auto-flush, so this usually answers `empty`; it exists for deterministic driving (tests, batch hosts). One generation per transaction . |
PRO | Promise<SyGridWorkbookSnapshotReport> | the sheet's last-published universe: generation, snapshot hash and every published cell (display-projected, with the canonical hash-alphabet text beside it so a consumer can re-derive the hash independently). `unpublished` before the first transaction — the published universe is the cells the hub has routed, NOT every grid cell. |
PRO | Promise<SyGridWorkbookIntegrityReport> | the cycle verdict over the live hub: whole-hub verdict counts, THIS sheet's non-acyclic cells, and the count of cells currently publishing `#CYCLE!` under the policy. Note the honest paint divergence: a cycle-member cell's own PAINT is the engine-local value while its PUBLICATION is `#CYCLE!` (PH-CYCLE-PAINT-01) — importing grids paint the published `#CYCLE!`. |
PRO input: SyGridSpillApplyInput | Promise<SyGridSpillApplyResult> | land a dynamic-array formula under the collision policy: a spill lands WHOLE or not at all. The anchor text is written through `applyTransaction` (the grid's single write authority, so undo/audit/cellValueChanged all ride it) with a facade-minted grid-wide mutation id (PH-UNDO-01); the engine half lands through the model. Coordinates are SHEET coordinates (definition/data order — formulas are display-independent). `landed-blocked` = occupied-only collisions: the anchor paints `#SPILL!` through the existing formula error path until the occupant leaves. Covered cells beyond the data rectangle compute but do not paint (PH-SPILL-COVER-01, reported in `unpaintedCells`). Refused on the dual (WASM-serving) engine lane — PH-SPILL-01, `engine-lane-unsupported`. |
PRO target: SyGridSpillTarget | Promise<SyGridSpillClearResult> | retire a landed spill anchor: the anchor data cell clears through the single write authority (minting its own mutation id) and the whole coverage heals through the model. |
PRO mutationId: GridMutationId | Promise<SyGridSpillUndoResult> | undo one spill transaction by its mutation id: the anchor's previous data content restores through the single write authority and the engine half retires/re-lands deterministically. An entry is consumed by its undo; grid-level `undo` reaches the same data half through the transaction it recorded. |
PRO | Promise<SyGridSpillReport> | the spill-state report over the live engine: every anchor's range (dims, status, per-range hash, engine-truth covered values), the loud overlap report, and the whole-model state hash. The refresh that answers it also HEALS coverage deltas . Refused on the dual lane (PH-SPILL-01). |
ColumnDef1
| ColumnDef | Type / Required | Description |
|---|---|---|
PRO | stringOptional | calculated column: a row-template formula (`'=B*C'`) evaluated by the formula engine for EVERY row. Bare column letters anchor to the row (`B` → `B3` on row 3); whole-column ranges (`SUM(D:D)`) and function names pass through. Requires the grid's `formulas` prop; the column is read-only (like a `valueGetter` column) and sorts/filters by its computed values. |
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.