Reputation: 9
I want to show the icon for particular users alone in the grid. I want to write this in listener function.
Upvotes: 0
Views: 4351
Reputation: 609
this is specific to action columns, in case the above solutions doesn't work. As it didn't for me. This might work
{
xtype: 'actioncolumn',
items : [{
icon : 'imagepath',
scope: this,
handler : function(grid, rowIndex, colIndex) {
//if you need one
},
getClass : function(value, meta, record, rowIx, ColIx, store) {
// Determines at runtime whether to render the icon/link
return (record.data.user === 'your_user') ?
'x-grid-center-icon': //Show the action icon
'x-hide-display'; //Hide the action icon
}
}]
}
Upvotes: 1
Reputation: 437
It is possible to use getClass to hide the icon based on condition. I'm not sure if that's what you're looking for though..
{
xtype: 'actioncolumn',
items: [{
icon: '/images/your_icon.png',
getClass: function(value, meta, record) {
if(record.get('user') === 'your_user') {
return 'x-hide-visibility';
}
}
}]
}
Upvotes: 1