SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.setCellStyleRows  method

将通过参数dataRowindicies而传递的CellStyle设置,个别设置在数据单元格。 它可以是数组的数组或JSON对象的数组。 在各个项目中,需要有注册在网格中的样式ID为其值。 

fieldMap中,将会设置把dataRowindicies的哪个位置的样式设置值,适用在数据组的哪个字段。 在数组的情况,将会指定数组索引 -> 字段,而在JSON对象的情况,则会指定JSON属性 -> 字段。 

重新设置显示着编辑器的数据单元格的编辑器状态,并且重新绘制网格。 

function setCellStyleRows (dataRowindicies: [Integer], fieldMap: *, startRowIndex: Integer, count: Integer);
Returns
Void
Parameters
dataRowindicies - [Integer]. required.
fieldMap - *. required.
startRowIndex - Integer. 默认值为0.
count - Integer. 默认值为-1.
如果没有指定,就会是DataSet.rowCount
Code -1
    // 'style01'等为注册在网格的CellStyle。
    var rows = [
        [ 'style01', 'style02' ],
        [ 'style03', 'style04' ]
    ];
    grid.setCellStyleRows(rows, {
        '0': 'country', // 将上述rows的第一个行的第0个项目值'style01,指定为DataSet的'country'字段的CellStyle id。
        '1': 'currency'
    })

通过JSON对象的数组,进行指定。 

Code -2
    var rows = [{
        'style_country': 'style02',  
        'style_currency': 'style01'
    }, {
        'style_country': 'style03',  
        'style_currency': 'style02'
    }];
    grid.setCellStyleRows(rows, {
        'style_country': 'country', // 将上述rows的'style_country'属性值'style02',指定为'country'字段单元格的样式id。
        'style_currency': 'currency'
    }, 3) // 从第四个DataSet行开始适用
See Also
setCellStyle
CellStyle
Examples
单元格样式