SMART datagrid v.1 > Classes > DataColumn

Back  Forward

DataLudi.DataColumn.dynamicStyles  property

Dynamic Style Collection which is applied when rendering data cells involved in this column. 

After applying GridBody.rowDynamicStyles, cellDynamicStyles, it will apply this dynamic style. 

Defaults to null.

Getter
function dynamicStyles(): DynamicStyleCollection
Setter
function setDynamicStyles(value: Array|Object)

The variables which can be used in expression of dynamic style are as below. 

Table-1  expression variables
VariableExplanation
'value'The value of data cell.
'row'index of grid row including the cell.
'datarow'dataIndex of grid row including the cell.
'field'index of data field connected to the cell.
'checked'If grid row is in checked state, it will be true.
'state'Data State of grid row including the cell. 'c': Creating, 'u': Updating, 'd': Deleting, 'x': Deleting after Creating
'tag'tag of cell column.
Code -1
    column.setDynamicStyles([{
        expression: 'value > 100',
        styles: { 
            background: '#880000', 
            foreground: '#ffffff' 
        }
    }, {
        expression: 'value > 50',
        styles: { 
            background: '#440000', 
            foreground: '#ffffff' 
        }
    }]);
    
    // or, when set the column in grid
    grid.setColumns([{
        name: 'col01',
        dynamicStyles: [{
            expression: 'value > 100',
            styles: { 
                background: '#880000', 
                foreground: '#ffffff' 
            }
        }, {
            ...
    }]);
See Also
Dynamic Styles Overview
DynamicStyle
GridBody.rowDynamicStyles
GridBody.cellDynamicStyles
DynamicStyleCollection
GridStyles
Examples
Column Dynamic Styles