-
28 Nov 2012 2:21 AM #1
Answered: Renderer Action Column
Answered: Renderer Action Column
I have this on a grid:
I want that when the field "possibleActions" is different than 2 to hide/remove the action column.Code:{ 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' } }] },
With thisit removes the icon from all the columns...Code:this.items[0].icon = '';
How can i access the column for the specific row that matches the condition??
-
Best Answer Posted by Mteixeira
I've solved it:
It seems that renderer overwrites the initial configuration and that was why all record had no icons.Code: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; },
-
28 Nov 2012 5:23 AM #2
I've solved it:
It seems that renderer overwrites the initial configuration and that was why all record had no icons.Code: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; },


Reply With Quote