PDA

View Full Version : Renderer Action Column



Mteixeira
28 Nov 2012, 2:21 AM
I have this on a grid:


{ xtype: 'actioncolumn',
renderer: function (val, metadata, record) {
if (record.raw.possibleActions != 2) {
this.items[0].icon = '';
this.items[0].tooltip = '';
}

metadata.style = 'cursor: pointer;';
return val;
},
width: 30,
align: 'center',
sortable: false,
items: [{
icon: 'images/edit.png',
tooltip: 'stuff',
handler: function (grid, rowIndex, colIndex) {
'do stuff'
}
}]
},

I want that when the field "possibleActions" is different than 2 to hide/remove the action column.
With this
this.items[0].icon = ''; it removes the icon from all the columns...

How can i access the column for the specific row that matches the condition??

Mteixeira
28 Nov 2012, 5:23 AM
I've solved it:



renderer: function (val, metadata, record) {
if (record.raw.possibleActions != 2) {
this.items[0].icon = '';
this.items[0].tooltip = '';
} else {
this.items[0].icon = 'images/edit.png';
this.items[0].tooltip = 'RELATÓRIO FINAL';
}


metadata.style = 'cursor: pointer;';
return val;
},


It seems that renderer overwrites the initial configuration and that was why all record had no icons.