2012-08-24 5 views
0

나는 다음과 같은 방식으로 데이터 그리드에서 하나 개의 특정 행을 비활성화 할 enhancedgrid 행해제 특정 행/

3) 해당 행에있는 셀의 인라인 편집을 비활성화하고 다른 행에 대해서는 인라인 편집을 허용합니다.

Pls. 아이디어가 있으면 도움을 받으십시오.

+0

프로그램을, 이외의 모든 구현 기능의 등 주위 방법이 없습니다 . 일부 해킹을 확인하십시오. http://stackoverflow.com/questions/3222893/how-to-show-a-checkbox-in-a-dojo-datagrid?rq=1 http://stackoverflow.com/questions/ 11334614/do-do-do-grid-and-add-dialog-from-data-model/11399717 # 11399717 1 : 사용 CSS 2 : 자신의 cellType을 정의하고 사용자 정의 이벤트가있는 체크 박스를 기반으로합니다. 3 : 자신의 기본 cellType을 정의하고 disable (레이아웃에서'editable '은 행 기반이 아니라 columnbased)을 필요로하는 모든 셀에서 cell.formatEditing (inDatum, inRowIndex)을 오버라이드 – mschr

+0

문제는 dojo의 그리드 행에 정의 된 고유 한 ID가 없다는 것입니다 . 그렇지 않으면 특정 행에 일부 사용자 정의를 쉽게 적용 할 수있었습니다. – Sandeep

+0

조작해야하는 행을 어떻게 알 수 있습니까? 상점 아이템별로? 색인으로? – mschr

답변

1

당신은 당신은, 그것은 (많은 당신이 열을 가지고로) 세포와 테이블이 포함 된 <div>rowNode으로해야합니다 물건을

// as example, one of youre items uses identifier:'id' and 'id:10' 
var identifier = '10'; 
var item = store._arrayOfTopLevelItems[10]; // you probably have this allready 
var index = grid.getItemIndex(item); // find which index it has in grid 
var rowNode = grid.getRowNode(index); // find a DOM element at that index 

를 추출하기 위해 다음과 같은 기능의 조합을 사용할 수 있습니다. 그 background-color

체크 박스 일을 설정, 당신은 prly가 초점 핸들러에서 작동 .. 편집이 정말 다른 가게

var cellNode = dojo.query('td[idx='+cellIndex+']', rowNode)[0]; 
// with cellType Bool, td contains an input 
var checkbox = cellNode.firstChild; 

이있는 셀 인덱스를 알 수 있습니다. 이를 덮어 쓰려면 편집 가능한 행 배열을 유지해야합니다 (셀을 제외하고 editable == true). 당신이 dojox.grid.DataGrid를 사용하는 경우

function inarray(arr, testVal) { 
    return dojo.some(arr, function(val) { return val == testVal }).length > 0 
} 
grid.setNonEditable = function (rowIndex) { 
    if(! inarray(this.nonEditable,rowIndex)) 
      this.nonEditable.push(rowIndex); 
} 
grid.setEditable = function (rowIndex) { 
    this.nonEditable = dojo.filter(this.nonEditable, function(val) { return val != rowIndex; }); 
} 
var originalApply = grid.onApplyEdit 
grid.onApplyEdit = function(inValue, inRowIndex) { 
    if(! inarray(this.nonEditable,inRowIndex)) 
     originalApply.apply(this, arguments); 
} 
0

당신이 행 편집 또는 셀 편집하지 않도록 canEdit 기능을 사용할 수 있습니다

grid = new dojox.grid.DataGrid({ 
    canEdit: function(inCell, inRowIndex) { 
     var item = this.getItem(inRowIndex); 
     var value = this.store.getValue(item, "name"); 
     return value == null; // allow edit if value is null 
    } 
}