-
9 Nov 2011 11:19 PM #1
Unanswered: How to add a listener on controller
Unanswered: How to add a listener on controller
Hi everyone.
I have this controller.
Code:Ext.define('deportes.controller.Controlador', { extend: 'Ext.app.Controller', views: ['HomePage', 'BuscadorEquipos'], //stores: ['Selectores'], refs: [ { ref: 'addFav', selector: '#addFav' } ], init: function() { this.control({ '#addFav': { 'itemtap': function(){ //this.addTeamFavorites; Ext.Viewport.setActiveItem({xtype:'homepage'}); //alert('shot');//this.addTeamFavorites } } }); } });
And i want to make a behaviour when user press the id #addFav in the view "buscadorequipos". I tried to "click", "tap" and "itemtap" without any results.
Can anyone help me?Code:Ext.define('deportes.view.BuscadorEquipos', { extend : 'Ext.form.Panel', alias : 'widget.buscadorequipos', config : { items: [ { xtype: 'fieldset', items: [disciplinas,modalidades,competiciones,equipos] }, { xtype: 'fieldset', html: '<strong id="addFav">F</strong>' } ] }, initialize : function() { console.log("InitComponent for homepage"); this.callParent(); } });
Thanks in advance.
-
10 Nov 2011 4:42 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
Using this.control() uses ComponentQuery so it can only listen for Components which DOM elements are not Components. To do this, you would have to listen for when the component is rendered via this.control() and then set a listener on that dom element.
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.
-
10 Nov 2011 6:42 AM #3


Reply With Quote