SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.setCellStyle  method

将通过参数dataRowIndexfield而指定的数据单元格适用于注册在网格styleId中的CellStyle。 

如果updateNowtrue,就会立即重新绘制单元格,而如果是显示编辑器的状态,就会一同重新设置编辑器的状态。 

如果在field中,指定小于0的值,就会适用于行的所有单元格。 而且,如果在dataRowIndex中,指定小于0的值,就会适用于被添加的行。 

function setCellStyle (dataRowIndex: Integer, field: Integer|String, styleId: String, updateNow: Boolean);
Returns
Void
Parameters
dataRowIndex - Integer. required.
连接在网格行的数据行号。GridRow.dataIndex
field - Integer|String. required.
数据字段索引或字段名称。
styleId - String. required.
这是注册在网格的CellStyle ID。
updateNow - Boolean. 默认值为false.
如果为true,就会在适用样式之后,重新进行绘制。
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
单元格样式