I want to know on click of a view, which ExtJS control was clicked. Do i need to subscribe to click on all the controls or is there a way I can subscribe to the root element and get actual ExtJS control clicked? I am able to find DOM elements but what i want is ExtJS control. I am using latest version ExtJs 5 and i want to listen to click on any element of a view which could be a Panel, Grid, Textarea etc. I am using a single event handler at the top level dom element. My code looks like follows:
listeners: {
click: {
element: "el",
fn: function fn(e,t) {
var domComp = Ext.get(t);
var xComp;
var currentNode = t;
while(true) {
var compID = currentNode.parentNode.id;
xComp = Ext.ComponentManager.get(compID);
if(xComp) break;
currentNode = currentNode.parentNode;
}
//Do something on xComp
}
}
}
I have been partially able to achieve this. But still the problem that I have is that I don't want the click handler for the actual control to be invoked? Just the handler I have written above should be invoked. For ex: if a checkbox is clicked, i don't want it to get checked but instead my above handler is invoked and i know that this checkbox was clicked? Any suggestions?