SMART datagrid v1.4 > 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.
지정하지 않으면 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) // 4번째 DataSet행 부터 적용
See Also
setCellStyle
CellStyle
Examples
Cell Styles