Dojo EnhancedGrid:如何使特定单元格而不是整个列可编辑

Dojo EnhancedGrid: How can I make particular cell editable not the entire column

假设 Grid 有 10 行,我想让 Cell(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");