user2473307
user2473307

Reputation: 9

How to hide the action column particular icon using listener function

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

Answers (2)

kavinder
kavinder

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

toree
toree

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

Related Questions