Forum /
Ext JS Community Forums 4.x /
Ext: Q&A /
Unanswered: EXT JS 4 MVC - call from controller a click event on a div
Unanswered: EXT JS 4 MVC - call from controller a click event on a div
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 () {
this .control({
'#myDiv' : {
event : this .myFunction
}
});
}
myFunction: function () {...} });
Wneh i click on myDiv i want to call myFunction. Thank you.
Sencha - Senior Forum Manager
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.
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us