2011-11-23 48 views

回答

3

我不知道如果這是你在找什麼,但知道「場」網格屬性,並確定列的索引我的蠻力的方法是這樣的:

var retrieveFieldIndexByFieldName = function(fieldName) { 
    var exGrid = dijit.byId("grid1"); // assuming grid1 is your grid 
    var index = -1; 
    dojo.forEach(exGrid.layout.cells, function(cell,idx) { 
     if (cell.field == fieldName) { 
      index = idx; 
      return false; // please do check if return false is needed here 
      // I actually forgot if this one was needed to exit the forEach loop of dojo 
     } 
    } 
    return index; 
} 

所以那裏。希望這可以幫助。

+0

感謝kyerie的快速反應。我正在尋找一些直接的方法來獲得它。認爲沒有直接的方法來得到它,我會採用上述方法。再次感謝.. – Vikram

相關問題