2013-05-17 1 views
0

셀 지지대를 사용하는 방법 (https://github.com/warpech/jquery-handsontable)는 handsontable : I 변경된 값을 강조하기 위해 사용 handsontable 세포를 사용하고자

cells function(row, col, prop) Defines the cell properties for given row, col, prop coordinates 

변화는 다른 함수이고 로우 시퀀스도 변화 일어난 . 그래서 나는 쉽게 변경된 셀에 행, 열로 태그를 붙일 수 없다. 그래서 내 유일한 선택은 세 번째 매개 변수 ("소품")라고 생각합니다. 그러나 소품은 재산을 의미합니까? 어떻게 각 셀에 대해 독립적이고 사용자 정의 된 속성을 할당 할 수 있습니까? 샘플 코드는 높이 평가됩니다. 덕분에

답변

1

"셀"옵션은 생성자 또는 열 옵션에 사용됩니다. 여기

은 사용 방법의 예입니다

$('div#example1').handsontable({ 
    cells: function (row, col, prop) { 
    var cellProperties = {} 
    if(row === 0 && col === 0) { 
     cellProperties.readOnly = true; 
    } 
    return cellProperties; 
    } 
}) 

당신이 변경 셀을 변경하려면, 다음 나는 "afterChange"한 번 봐를 제안 :

$('div#example1').handsontable({ 
    afterChange: function (changes, source) { 
    if (source=== 'loadData') { 
     return; //don't do anything as this is called when table is loaded 
    } 
    var rowIndex = changes[0]; 
    var col = changes[1]; 
    var oldCellValue = changes[2]; 
    var newCellValue = changes[3]; 
    // apply your changes... 
    } 
}) 

을 이 도움이 되었기를 바랍니다.

+0

감사합니다. 나는 그것을 시도 할 것이다. –