1
如何從dojo增強網格中的列名獲取列索引? 任何幫助,將不勝感激如何從dojo中的列名獲取列索引增強的網格?
如何從dojo增強網格中的列名獲取列索引? 任何幫助,將不勝感激如何從dojo中的列名獲取列索引增強的網格?
我不知道如果這是你在找什麼,但知道「場」網格屬性,並確定列的索引我的蠻力的方法是這樣的:
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;
}
所以那裏。希望這可以幫助。
感謝kyerie的快速反應。我正在尋找一些直接的方法來獲得它。認爲沒有直接的方法來得到它,我會採用上述方法。再次感謝.. – Vikram