SMART datagrid v.1 > Classes > ValueColumn

Back  Forward

DataLudi.ValueColumn.styleCallback  property

Callback function which is called at the point of rendering data cell. 

function (index:CellIndex, styles:GridStyles);

You can change the properties of style set which is transferred by callback parameter styles within this function. index is the location of data cell which is being rendered now. 

This function will be called at last after all applying style values included in Column Default Styles, Dynamic Styles and CellStyle specified in each data cell. 

You can specify the default callback of all columns through GridBody.styleCallback(v 1.3.6). If specify column callback, it will not call the callback of GridBody. 

Defaults to null.

Getter
function styleCallback(): Function
Setter
function setStyleCallback(value: Function)
Code -1
    column.setStyleCallback(function (index, styles) {
        var v = index.getValue();
        if (v > < 100) {
            styles.setBackgrouund('#ff0000');
            styles.setForeground('#ffffff');
        }
    });
    // In most cases, it will be set when initializing grid.
    grid.setColumns([
        {
            name: 'col1',
            styleCallback: function (index, styles) {
                styles.extend({
                    backgrouund: '#ff0000',
                    foreground: '#ffffff'
                });
            }
            ...
        },  ...
    ]);
See Also
CellIndex
GridStyles
GridBody.styleCallback
GridColumn.styles
DataColumn.dynamicStyles
GridBody.rowDynamicStyles
GridBody.defaultDynamicStyles
CellStyle
GridBase.setCellStyle
Dynamic Styles Overview
Examples
Icon Cell Rendererer