DataLudi Grid v.1 > Classes > DataColumn

Back  Forward

DataColumn.styleCallback  property

function (index:CellIndex, styles:GridStyles);

Callback function, to be called when rendering a dataCell It is able to update properties of styleSet passed styles callback parameter in this function. Index is the location of dataCell which is drawn currently. 

This function is called last after all applying column basic styles and dynamic styles. 

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');
        }
    });
    // Generally, set at initializing a grid.
    grid.setColumns([
        {
            name: 'col1',
            styleCallback: function (index, styles) {
                styles.extend({
                    backgrouund: '#ff0000',
                    foreground: '#ffffff'
                });
            }
            ...
        },
            ...
    ]);
See Also
CellIndex
GridStyles
GridColumn.styles
DataColumn.dynamicStyles
GridBody.rowDynamicStyles
GridBody.defaultDynamicStyles
CellStyle
GridBase.setCellStyle
Dynamic Styles Overview
Examples
[[e.IconRenderer]Icon Cell Rendererer