PDA

View Full Version : show actioncolumn in a tree but only in specific rows



ultra2
13 Dec 2012, 9:07 AM
I need actioncolumn icon show up only in specific (leaf) rows.
{
xtype: 'treepanel',...
{
xtype:'actioncolumn',
items: [
{
icon: 'myicon.png',
handler: function(grid, rowIndex, colIndex) { // do something when icon is clicked },
}
}
}

mitchellsimoens
15 Dec 2012, 7:47 AM
use the getClass means:

{

getClass: function(v, meta, rec) {
if (rec.get('change') < 0) {
return 'alert-col';
} else {
return 'buy-col';
}
},
getTip: function(v, meta, rec) {
if (rec.get('change') < 0) {
return 'Hold stock';
} else {
return 'Buy stock';
}
},
handler: function(grid, rowIndex, colIndex) {
var rec = store.getAt(rowIndex);
alert((rec.get('change') < 0 ? "Hold " : "Buy ") + rec.get('company'));
}
}