PDA

View Full Version : Extjs adding an click event listener on a div for treecolumn not working



naren.nf
2 Feb 2014, 1:19 AM
I have been trying to register for a click event on div of the treecolumn which is customized overriding renderer. Somehow I do not the see the event being fired. I appreciate if anyone point me why my code below is not working.


Ext.define('CustomColumn', {
extend: 'Ext.tree.Column',
listeners:{
'boxready': 'onColumnRendered'
},


renderer: function (value, p, record) {
var contentHtml = [];
contentHtml.push('<div class="column-label">'+record.get('text') +'</div>');
contentHtml.push('<div class="column-action">"test"</div>');
return contentHtml.join('');
},


onColumnRendered: function(){
var me = this;
me.mon(me.el, 'click', function(){"grid column clicked"}, me, {delegate: '.column-action'});
}
});


Also please let me know how I get the record associated with the column in the click event listener

slemmon
6 Feb 2014, 11:51 AM
What if you use the tree's cellclick event instead.
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.tree.Panel-event-cellclick

That event will give you access to the column index (cellindex is what it is called in the API doc). You can used that to determine if the listener should process the event or not by seeing if the click happened on the column you want to monitor clicks on or not.

naren.nf
11 Feb 2014, 10:02 AM
Thank you. I think I can try to use Itemclick or cellclick.