In grid 'actioncolumn' i displayed an image using 'renderer' like,
image + text
On action column click i am calling some action,
but click event is triggering even click on empty space in grid cell. how to prevent that click on empty space.
how to identify click on link (image+text), not on grid cell empty space.
{
xtype: 'actioncolumn',
width: '17%',
text: 'Display Option',
renderer: function (value, metadata, record) {
var label = '';
if (record.get('status') == 0) {
lable = 'Show';
etadata.style += 'margin-top:10px;cursor:pointer;';
return '<span style="font-size: 14px; color:#3b87de; font-family:arial; margin-left:-3px;">' + '<img src="resources/images/show_msg.png"/>' + label + '</span>'
} else {
metadata.style += 'margin-top:10px;cursor:pointer;';
lable = 'Hide';
return '<span style="font-size: 14px; color:#3b87de; font-family:arial;">' + '<img src="resources/images/hide_fault.png"/>' + label + '</span>'
}
},
handler:function(grid, rowIndex, columnIndex, e){
console.log('handler test');//not triggering
},
listeners: {
click: function ( grid, rowIndex, colIndex) {
console.log('handler test');// triggering
}
}
Thanks
I'm using ExtJs 4.2.2, and I never had the issue. I define my actioncolumns like this:
{
xtype: 'actioncolumn',
items: [{
tooltip: Lang._('Tooltip for edit'),
handler: function(grid, ri, ci, me, e, rec, rEl) {this.up('grid').fireEvent('editAction', grid, ri, ci, me, e, rec, rEl)},
getClass: function(value, metadata, record){
return '[css class for background image]'
}
},{
...
}],
menuDisabled: true
}
The in the controller I have:
init: function(){
this.control({
'[xtype of grid]': {
editAction: this.onEditAction,
}
})
},
onEditAction: function(grid, rowIndex, colIndex, me, event, record, rowEl){
Ext.Msg.alert('Info', 'edit clicked')
},
Probably you defined the handler for the action column, instead of definig a handler for each item.