PDA

View Full Version : Listeners not working on grid?



anubite
14 May 2011, 5:32 AM
Hi all,

I am having one problem, using MODx CMF with implemented ExtJS 3.3.0. I am setting up a grid and I want to use listeners on it. I tried to use 'click' and 'dblclick' events for test, but it's not working! I am stuck on it for two days now. Can anybody help me, please? I am attaching the code.




/* GRID */
Simpleshop.grid.ProductParam = function(config) {
config = config || {};

Ext.applyIf(config,{
id: 'simpleshop-grid-product-param'
,url: Simpleshop.config.connectorUrl
,baseParams: { action: 'mgr/product/paramList', id: MODx.request['id'] }
,fields: ['param_id','param_label','param_output_modifier_label','param_required','value']
,paging: false
,remoteSort: false
,anchor: '97%'
,autoExpandColumn: 'param_name'
,columns: [{
header: _('ss.field.name')
,xtype: 'templatecolumn'
,tpl: '{param_label} ({param_output_modifier_label})'
,sortable: false
,width: 100
},{
header: _('ss.field.required')
,xtype: 'booleancolumn'
,trueText: _('ss.truetext')
,falseText: _('ss.falsetext')
,dataIndex: 'param_required'
,sortable: false
,width: 30
,align: 'center'
},{
header: _('ss.field.value')
,dataIndex: 'value'
,sortable: false
,width: 150
,editor: { xtype: 'textfield' }
}]
,listeners: {
click: {
fn: function(){ console.log('click'); } // not working
},
dblclick: {
fn: function(){ console.log('dblclick'); } // not working
}
}

});


Simpleshop.grid.ProductParam.superclass.constructor.call(this,config);

};
Ext.extend(Simpleshop.grid.ProductParam,MODx.grid.Grid,{


});
Ext.reg('simpleshop-grid-product-param',Simpleshop.grid.ProductParam);

fay
14 May 2011, 6:10 AM
It should be:



listeners: {
click: function(){
console.log('click');
},
dblclick: function(){
console.log('dblclick');
}
}

anubite
14 May 2011, 6:13 AM
Tried it, still not working. I am clicking on grid and nothing appears on console.

fay
14 May 2011, 6:18 AM
I just put that code in the examples\grid\array-grid.js example and it works fine. There's something else amiss with your code.

anubite
14 May 2011, 6:21 AM
Yes, probably it's a mistake somewhere in MODx extension of a grid component. :-/ I'll have to figure it out. Anyway, thanks for your advice.