SMART datagrid v.1 > Classes

[ grids ver.1.3.1]   Back  Forward

DataLudi.DynamicStyleCase  class

The dynamic style object array in which has set Expression or Callback Function

It will apply the style set which has passed after running the callback or expression in order and ignore the rest. It is similar to switch case of JavaScript. If callback exists in the corresponding location, the expression will be ignored. And, if do not set Style Set in the corresponding location, it will use the one which has been set before. 

When add as setting objects in DataColumn.dynamicStyles, if there is "expressions" or "callbacks" property in setting object, it will be created as this object. 

Base Classes
DynamicStyle > DLBase
Constructor
function DynamicStyleCase (owner: Object, config: Object);
Properties
callbacks
expressions
styles
Inherited Methods
DLBase.assign
DLBase.getProperties
DLBase.getProperty
DLBase.setProperties
DLBase.setProperty
DLBase.toggle

 

Code -1
    var columns = [{
        name: 'colQty',
        fieldName: 'quantity',
        dynamicStyles:[{
            expressions: [
                "row % 5 == 0",
                "row % 3 == 0"
            ],
            styles: [{
                shapeSize: size1,
                numberFormat: fmt1
            }, {
                shapeSize: size2,
                numberFormat: fmt2
            }]
        }]
    }, {
        callbacks: [
            function (cell) {
                return cell.rowIndex() % 5 == 0;
            },
            function (cell) {
                return cell.rowIndex() % 3 == 0;
            }
        ],
        styles: [{
            shapeSize: size1,
            numberFormat: fmt1
        }, {
            shapeSize: size2,
            numberFormat: fmt2
        }]
    },
    ...
    ];
    grid.setColumns(columns);
See Also
DataColumn.dynamicStyles
Examples
Column Dynamic Styles
DefaultDynamicStyles