javascript - Dojo 增强网格 : How can I make particular cell editable not the entire column

标签 javascript dojo dojox.grid.datagrid dojox.grid

假设网格有 10 行,我想让单元格(col2 字段的第 9 行)可编辑。您能给我解决这个问题吗?

这是我的网格

var grid = new dojox.grid.EnhancedGrid({
    store: store,
    autoWidth: true,
    structure: [
        { name: "Number", field: "col1", width: "84px", editable: false},
        { name: "Description", field: "col2", width: "84px", editable: false },
        { name: "Stock", field: "col3", width: "84px", editable: false }
    ]
}, "grid");

最佳答案

尝试使用 canEdit 函数,如下所示。下面的示例展示了如何不使第一个单元格不可编辑。

var grid = new dojox.grid.EnhancedGrid({
    store: store,
    autoWidth: true,
    structure: [
        { name: "Number", field: "col1", width: "84px", editable: false},
        { name: "Description", field: "col2", width: "84px", editable: false },
        { name: "Stock", field: "col3", width: "84px", editable: false }
    ],
 canEdit: function (inCell, inRowIndex) {
            if (inRowIndex && inCell.index === 0) {
                return false;
            }
            return this._canEdit;
        }
}, "grid");

关于javascript - Dojo 增强网格 : How can I make particular cell editable not the entire column,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50657338/

相关文章:

javascript - 实时进度条

javascript - 当用户使用 Dojo 滚动到底部时加载新内容?

ios - Dojo:所有可 ScrollView 在应用程序启动时一起呈现

javascript - 突出显示增强网格中的单元格的事件

javascript - Dojo Toolkit store.在 TextBox 内获取值

javascript - 使用 .keypress 过滤数据 - 无插件

javascript - 如何禁用 Iframe 内的右键单击

javascript - 在for循环中循环遍历google Maps Api

javascript - 获取增强网格的过滤器插件查询

javascript - Dojo DataGrid 未显示