实例的代码已经可以实现这种需求了
{
xtype: 'actioncolumn',
width: 50,
sortable: false,
menuDisabled: true,
items: [
{
handler: function(view, rowIndex, colIndex, item, e) {
this.fireEvent('itemclick', this, 'sell', view, rowIndex, colIndex, item, e);
},
icon: 'images/fam/delete.gif',
tooltip: 'Sell stock'
},
{
getClass: function(v, metadata, r, rowIndex, colIndex, store) {
if (r.get('change') < 0) {
this.items[1].tooltip = 'Hold stock';
return 'alert-col';
} else {
this.items[1].tooltip = 'Buy stock';
return 'buy-col';
}
},
handler: function(view, rowIndex, colIndex, item, e) {
var rec = view.getRecords(view.getNodes())[rowIndex];
var action = rec.get('change') < 0 ? 'hold' : 'buy';
this.fireEvent('itemclick', this, action, view, rowIndex, colIndex, item, e);
}
}
]
}