View Full Version : EXT JS 4 MVC - call from controller a click event on a div

2 Sep 2012, 11:39 PM
I was wondering if it's possible to catch a click event on a certain div from the controller in an EXT JS 4 MVC app.
Lets say we have:

Ext.define('MyApp.controller.myController', {
extend : 'Ext.app.Controller',
init : function() {
'#myDiv' : {
event: this.myFunction
myFunction: function() {...} });
Wneh i click on myDiv i want to call myFunction. Thank you.

17 Sep 2012, 6:32 AM
The control method will only be able to listen to events on controllers not elements. The way I usually do is have the listener within the component and then fire a custom event on the component so that the controller can then listen to it.