SMART datagrid v.1 > Classes

Back  Forward

DataLudi.CalculatedColumn  class

The column which displays the value determined by the expression specified by expression or callback function in the necessary point rather than the value of Data Set

The data type of column is specified by valueType property. The default type is NUMBER. The values of these column cells are not stored by default but determined by expression result specified by valueExpression property or result value of valueCallback function at the moment of being displayed, and if set cached property as true, it will store the value which has been calculated once and use it when display again. However, here as elsewhere, you should not premise that the value has been stored. 

When creating column through setting information, it will specify "type" as "calced"

Base Classes
DerivedColumn > ValueColumn > GridColumn > DLBase
Properties
cached
calcBounds
calcRange
nanText
nanValue
valueCallback
valueExpression
valueType
Inherited Properties
ValueColumn.blankWhenCopy
GridColumn.checked
ValueColumn.copyCallback
ValueColumn.cursor
GridColumn.dataRoot
ValueColumn.displayCallback
GridColumn.displayIndex
GridColumn.displayText
GridColumn.distance
DerivedColumn.editable
GridColumn.fillHeight
GridColumn.fixed
GridColumn.footer
GridColumn.grid
GridColumn.group
GridColumn.groupFooter
GridColumn.header
GridColumn.height
ValueColumn.ignoreDefaultDynamicStyles
ValueColumn.ignoreRowDynamicStyles
GridColumn.index
GridColumn.isDataRoot
GridColumn.isFixed
GridColumn.isRoot
ValueColumn.mergeCallback
ValueColumn.mergeExpression
ValueColumn.mergeValueCallback
ValueColumn.mergeValueExpression
GridColumn.movable
GridColumn.name
GridColumn.parent
ValueColumn.pasteCallback
ValueColumn.renderer
GridColumn.resizable
GridColumn.root
ValueColumn.styleCallback
GridColumn.styleName
GridColumn.styles
ValueColumn.summaryCallback
GridColumn.tag
ValueColumn.tooltipCallback
GridColumn.visible
GridColumn.width
Inherited Methods
DLBase.assign
DerivedColumn.ctor
ValueColumn.ctor
GridColumn.ctor
DLBase.getProperties
DLBase.getProperty
DLBase.setProperties
DLBase.setProperty
DLBase.toggle

 

Note
Code -1
    grid.setColumns([{
        name: "colAmount",
        type: "calced",
        valueType: DataLudi.ValueType.NUMBER, // The default value
        valueExpression: "unit_price * quantity",
        // or callback
        valueCallback: function (column, row) {
            return row.getValue('unit_price') * row.getValue('quantity');
        },
        styles: {
            "numberFormat": "#,##.00"
        }
    }, {
        ...
    }]);
See Also
DataSet
LabelColumn
Examples
Row Summary