2014-01-22 3 views
0

나는 비교적 새로운 Dojo이다. DataGrid를 사용하고 있는데, 여기에는 열 중 하나에 텍스트 상자가 있습니다. 사용자가 특정 행의 텍스트 입력에 일부 데이터를 입력 할 때 모눈의 행 인덱스를 알고 싶습니다.Dojo에서 선택된 행 인덱스를 찾는 방법

'name' : 'Partner Column Name', 
'field' : 'text', 
'width' : '25%', 
'field' : 'partnerColumnName', 
'text-align': 'center', 
'editable' : true, 
'type' : dojox.grid.cells._Widget, 
'formatter' : function()        
{ 
return new dijit.form.TextBox({style:"width:100%", id: "textBox_"+counter++,   onChange: function() 
{ 
    // Here I want to know the row index of the grid. 
} 

누군가 나를 도와 줄 수 있습니까?

감사합니다, NIRMAL 쿠마 Bhogadi

답변

0

DataGrid를의 코드를보고 난 formatter 콜백은 두 개의 매개 변수를 얻는 것으로 나타났습니다 (dojox/grid/cells/_Base하는 것은 정확합니다) 때 :

  • 원래 값
  • 을 행 색인 (inRowIndex)

그래서 n은 쉽게 행 인덱스를 검색합니다. 예를 들면 다음과 같습니다.

formatter: function(myValue, rowIndex) { 
    // Do something with rowIndex 
} 
0

그리드의 전체 선택된 행 데이터가 필요하다고 생각합니까? 이것이 내 프로젝트에서 사용하는 것입니다 :

var grid = dijitRegistry.byId('yourGridId');  
if (!grid || !grid.selection || grid.selection.getSelected()) { 
    console.log(grid.selection.getSelected()); 
} 
관련 문제