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

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',
'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

6 Feb 2014, 11:51 AM
What if you use the tree's cellclick event instead.

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.

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