SMART datagrid v.1 > Classes > CalculatedColumn

Back  Forward

DataLudi.CalculatedColumn.valueExpression  property

Expression which returns the value of calculated column cell. 

If specify valueCallback, this value will be ignored. 

You can use field names as variable in expression. And, besides field names, you can also use the variables listed in the table below in expression. 

Defaults to null.

Getter
function valueExpression(): String
Setter
function setValueExpression(value: String)
Note
Table-1  CalculatedColumn.valueExpression variables
VariableExplanation
'tag'Data tag
'datarow'The Index of data row.
'row'The Index of grid row.
'state'The state of data row.
'prevval'The same field value of previous row.
'nextval'The same field value of next row.
'values'Get the value by field name or field index of fields.
'prevvals'Get the value by field name or field index of fields of previous rows.
'nextvals'Get the value by field name or field index of fields of next rows.
Code -1
    grid.setColumns([{
        name: "colAmount",
        type: "calced",
        // You can directly use the field name in expression.
        valueExpression: "unit_price * quantity"
    }, 
        ...
    ]);
See Also
valueCallback
valueType
nanValue
Examples
Calculated Column
Total Calculated Column