即使 isAdmin 值为 false,行编辑仍处于启用状态。我认为 View 中的绑定(bind)属性不起作用。如果有的话可以提供帮助。谢谢。 View 中的代码:
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2,
pluginId: 'rowEditor',
listeners: {
cancelEdit: 'onCancelClick',
edit: 'onEditClick'
},
bind: {
disabled: '{!isAdmin}'
}});
Controller 中的另一部分代码:
init: function () {
var access = (user_Access[0].Admin == 'True');
if (access) {
var vm = this.getViewModel();
vm.set("isAdmin", access);
}
}
最佳答案
在您的 View 模型中,您应该使用 View 模型数据和 formulas为了实现这一点并根据 Sencha 最佳实践:
viewModel: {
data: {
isAdmin: false
},
formulas: {
disabled: function(get) {
return get('isAdmin') ? false : true
}
}
}
...
bind: {
disabled: '{disabled}'
}
关于javascript - 网格 Ext JS 中没有禁用行编辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52011411/