简单记录一下actioncolumn
的动态隐藏,分为两个部分:
- 样式隐藏,使用
getClass
根据条件返回样式,可以为隐藏this.disabledCls
- 功能隐藏,否则的话
actioncolumn
虽然样式产生了变化,比如隐藏或者半透明(也就是disable),但是事件依然可以触发。所以需要设置isDisabled
columns.push({
xtype: 'actioncolumn',
text: '操作',
align: 'center',
width: 90,
items: [{
tooltip: '选择',
scope: me,
handler: function (grid, rowIndex) {
//todo
},
getClass: function (v, metadata, record) {
var type = record.raw['M_TYPE_' + me.modelId];
if (type === '附件') {
return this.disabledCls;
} else {
return 'icon-select';
}
},
isDisabled: function (view, rowIndex, colIndex, item, record) {
var type = record.raw['M_TYPE_' + me.modelId];
if (type === '附件') {
return true;
} else {
return false;
}
},
}]
})
网友评论