最近工作中做按钮级权限用到了按钮禁用这个功能,很好用也很美观,特此贴出来供各位小伙伴参考
效果图:
实现:
- 使用时通过下图的if语句判断是否禁用按钮
代码:
{xtype : "actioncolumn",align : "center",text : '操作',id : "cZ",
items : [
{xtype : 'button',tooltip : '重新分配',icon : jcapp.getIcon("application_form_edit.png"),
isDisabled: function (view, rowIndex, colIndex, item, rec) {
if (buttonArr.includes('001001006002') ) {
return false; //显示
}else {
return true; //禁用
}
},
handler : function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
}
}
]
}