DevExtreme Grid - 编辑模式
DevExtreme Grid - Editing mode
tvaLst = [{
编号:1,
人造革:5,
ole: 真},
{ 编号:2,
人造革:13.01,
奥莱:假
}];
想象一下,我从一个服务中检索了上面的对象列表,并且我想显示 taux 值,并且在第二列中,仅针对属性 ole 设置为 true 的行显示编辑和删除选项。
this.gridSettings = {
bindingOptions: { dataSource: 'vm.tvaLst' },
allowColumnResizing: true,
scrolling: { mode: 'virtual' },
onContentReady: this.contentReadyAction,
paging: { enabled: false },
editing: {
mode: "row",
allowUpdating: true,
allowDeleting: true,
allowAdding: true
},
columns: this.gridColumns
};
在编辑中我应该怎么做才能允许这个?
您可以在 onCellPrepared 事件处理程序中找到并隐藏编辑按钮。
这是一个示例代码:
onCellPrepared: function (options, $container) {
if (options.column && options.column.command === "edit" && options.rowType == "data") {
if (options.cellElement.find('a').first().text() === 'Edit') {
if (options.data.ole === false){
options.cellElement.find('a').first().hide();
options.cellElement.find('a').eq(1).hide();
}
}
}
}
tvaLst = [{ 编号:1, 人造革:5, ole: 真}, { 编号:2, 人造革:13.01, 奥莱:假 }];
想象一下,我从一个服务中检索了上面的对象列表,并且我想显示 taux 值,并且在第二列中,仅针对属性 ole 设置为 true 的行显示编辑和删除选项。
this.gridSettings = {
bindingOptions: { dataSource: 'vm.tvaLst' },
allowColumnResizing: true,
scrolling: { mode: 'virtual' },
onContentReady: this.contentReadyAction,
paging: { enabled: false },
editing: {
mode: "row",
allowUpdating: true,
allowDeleting: true,
allowAdding: true
},
columns: this.gridColumns
};
在编辑中我应该怎么做才能允许这个?
您可以在 onCellPrepared 事件处理程序中找到并隐藏编辑按钮。
这是一个示例代码:
onCellPrepared: function (options, $container) {
if (options.column && options.column.command === "edit" && options.rowType == "data") {
if (options.cellElement.find('a').first().text() === 'Edit') {
if (options.data.ole === false){
options.cellElement.find('a').first().hide();
options.cellElement.find('a').eq(1).hide();
}
}
}
}