【发布时间】:2012-01-04 12:05:43
【问题描述】:
如何从 dojo 增强网格中的列名获取列索引 ???? 任何帮助将不胜感激
【问题讨论】:
标签: dojox.grid dojox.grid.datagrid
如何从 dojo 增强网格中的列名获取列索引 ???? 任何帮助将不胜感激
【问题讨论】:
标签: dojox.grid dojox.grid.datagrid
我不知道这是否是您要查找的内容,但是我知道网格的“字段”属性并确定列索引的蛮力方式是这样的:
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;
}
就是这样。希望这会有所帮助。
【讨论】: