如何从 dojo 增强网格中的列名中获取列索引????任何帮助,将不胜感激
问问题
2950 次
1 回答
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;
}
所以在那里。希望这可以帮助。
于 2011-11-23T06:40:03.500 回答