假设网格有 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/