SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.setCellStyle  method

Apply the data cell specified by parameter dataRowIndex and field to CellStyle registered by styleId in grid. 

If updateNow is true, it will immediately redraw the cell, and if the editor was being displayed, it will also reset the state of editor. 

If specify the value less than 0 in field, it will be applied to all cells of row. And, if specify the value less than 0 in dataRowIndex, it will be applied to the row being added. 

function setCellStyle (dataRowIndex: Integer, field: Integer|String, styleId: String, updateNow: Boolean);
Returns
Void
Parameters
dataRowIndex - Integer. required.
The number of data row which is connected to grid row. GridRow.dataIndex
field - Integer|String. required.
Data field index or field name.
styleId - String. required.
CellStyle ID which is registered in grid.
updateNow - Boolean. Defaults to false.
If it is true, it will redraw immediately after applying the style.
Code -1
    grid.registerCellStyles([{
        id: 'style01', 
        "background": "#880000",
        "color": "#ffffff"
    }, {
        id: 'style02', 
        background: "#000088",
        color: "#ffffff"
    }];
    grid.setCellStyle(0, 'country', 'style01', true);
note
See Also
GridBase.registerCellStyles
setCellStyles
CellStyle
Examples
Cell Styles