SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.setCellStyleRows  method

Individually set CellStyle settings being transferred by parameter dataRowindicies in data cells. It can be array of arrays or array of JSON object. In each item, Style ID being registered in grid should be in as the value. 

In fieldMap, it will set to select the style setting value of which location in dataRowindicies and apply in which field of data set. In the case of array, it will specify Array index -> Field, and in the case of JSON object, it will specify JSON property -> Field

Reset the state of editor of data cell in which was displaying the editor and redraw the grid. 

function setCellStyleRows (dataRowindicies: [Integer], fieldMap: *, startRowIndex: Integer, count: Integer);
Returns
Void
Parameters
dataRowindicies - [Integer]. required.
fieldMap - *. required.
startRowIndex - Integer. Defaults to 0.
if it is not specifed, 0.
count - Integer. Defaults to -1.
If do not specify, it will be DataSet.rowCount.
Code -1
    // CellStyle of being registered in grid such as 'style01', etc.
    var rows = [
        [ 'style01', 'style02' ],
        [ 'style03', 'style04' ]
    ];
    grid.setCellStyleRows(rows, {
        '0': 'country', // Specify the 0th item value 'style01' of first row among above rows as CellStyle id of 'country' field of DataSet.
        '1': 'currency'
    })

Specify by array of JSON object. 

Code -2
    var rows = [{
        'style_country': 'style02',  
        'style_currency': 'style01'
    }, {
        'style_country': 'style03',  
        'style_currency': 'style02'
    }];
    grid.setCellStyleRows(rows, {
        'style_country': 'country', // Specify 'style02' of 'style_country' property value among above rows as style id of 'country' field cell.
        'style_currency': 'currency'
    }, 3) // Apply from the fourth DataSet row.
See Also
setCellStyle
CellStyle
Examples
Cell Styles