如何在dojo增强网格中从列名获取列索引



如何从dojo增强网格????中的列名获得列索引如有任何帮助,不胜感激

我不知道这是不是你想要的,但是我的蛮力方法知道网格的"field"属性并确定列的索引是这样的:

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;
}

相关内容

  • 没有找到相关文章

最新更新