SMART datagrid v.1 > Classes > GridBody

[ grids ver.1.3.6]   Back  Forward

DataLudi.GridBody.styleCallback  property

Callback function which is called when rendering data cell. 

function (index:CellIndex, styles:GridStyles);

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

This function is called finally after all applying Column Default Style and Dynamic Styles and style values included in CellStyle specified by each data cell. 

It is not called from the cell included in column in which has set DataColumn.styleCallback

Defaults to null.

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