PDA

View Full Version : How to listen for event on Xtemplate element inside controller?



JohnJones357
26 Jan 2014, 9:07 PM
Is this possible? I know to get an xtemplate element by its div class I can use Ext.query(.divClassName)....but how do I do it in this.control?

I have in this.control({

".divClassName": {
"itemclick": this.doSomething
}

but it does not work.

skirtle
27 Jan 2014, 2:42 AM
Controllers listen for events on components (views), not elements. Elements should always be managed by their components, not treated a separate entities like you might using jQuery.

In short, the component should be listening for the DOM event and firing a relevant component event for the controller.

Further reading:

http://skirtlesden.com/articles/html-and-extjs-components

JohnJones357
27 Jan 2014, 2:00 PM
fireEvent works. thanks