-
23 Jan 2012 1:31 PM #1
Answered: Catching events in controler
Answered: Catching events in controler
Hi,
I am using v2 PR3 and controller cannot catch click event on img (same on panel). Can you help me with this ?
Code:Ext.define('Test.controller.Main', { extend: 'Ext.app.Controller', views : [ 'Main','Viewport' ], init: function() { this.getMainView().create(); this.control({ 'img': { tap : this.onClickCards } }); }, onClickCards: function() { alert('123'); } });Code:Ext.define('Test.view.Main', { extend: 'Ext.Container', initComponent: function() { var info = new Ext.Panel({ html: '<img src="img/icon.png"/>', }); Test.view.Main.superclass.initComponent.call(this);
-
Best Answer Posted by mitchellsimoens
this.control can only listen to component events, not element events. You would need to listen for the tap event in a painted event.
-
23 Jan 2012 1:51 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
- Answers
- 3105
this.control can only listen to component events, not element events. You would need to listen for the tap event in a painted event.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Jan 2012 2:32 PM #3


Reply With Quote