Grid Component - Formula

30 Sep 20263 minutes to read

Coordinator for formula parsing, evaluation, and dependency tracking

Methods

addFormula

Adds a custom formula function.

Parameter Type Description
name string The name of the custom formula function.
handler Function The handler function for the custom formula.

Returns void

destroy

Destroys the formula module.

Returns void

getCellFormula

Gets a stored formula.

Parameter Type Description
primaryKeyValue number | string The row index or primary key of the record.
field string The field name containing the formula.

Returns string | undefined

getFormulaValue

Gets the evaluated value of a formula.

Parameter Type Description
primaryKeyValue number | string The row index or primary key of the record.
field string The field name containing the formula.

Returns FormulaValue | undefined

getFormulas

Gets all formulas defined in the grid.

Returns FormulaDefinitionModel[]

hasFormula

Checks if a formula exists for the specified cell.

Parameter Type Description
primaryKeyValue number The row index of the cell.
field string The field name of the cell.

Returns boolean

removeFormula

Removes a custom formula function.

Parameter Type Description
name string The name of the custom formula function to remove.

Returns void

setCellFormula

Sets a formula for a cell.

Parameter Type Description
primaryKeyValue number | string The row index or primary key of the record.
field string The field name for which the formula is being set.
formula string | undefined The formula to store, or undefined to clear the formula.

Returns void