GridPanel 的 ActionColumn 中,根據某列值(如 price > 50)動態隱藏操作圖標。ExtJS 3.3 版本。
截圖:


利用 getClass 配置返回 CSS 類名控制顯隱(3.3 雖未文檔但支持):
.hideop { display: none; }
// 列配置
{
xtype: 'actioncolumn',
header: 'operate',
items: [{
icon: '1.png',
getClass: function(v, meta, record) {
if (record.get('price') > 50) return 'hideop';
return '';
}
}]
}
getClass 參數:v(值)、meta(元數據)、record(整行 Record)、rowIndex、colIndex、store。返回樣式類名即可控制圖標顯隱。