-
15 Feb 2013 11:09 AM #1
Answered: Tap event on textField
Answered: Tap event on textField
Hi so I have a text field component inside my container. I made it so that it is read only, and would like to add a tap event to it. I understand that the text fields does not have a tap event so I looked around and found a possible solution. It works for the most part except that it makes the whole container listen to the tap event, the fireEvent is not working correctly, and I am not sure how fire the event for the specific element tapped. Here is my code. Any help would be great thanks.
Code:Ext.define('GS.view.newEventsView',{ extend:'Ext.Container', xtype:'newEventsView', initialize:function(){ var me = this; me.element.on('tap', 'doBubbleTap', me); me.callParent(); }, doBubbleTap : function(e, t) { this.fireEvent('play', this, e , t); }, tap: function(caller, event, target){ console.log(event); console.log(target); }, } // my tool bar goes here and some other items like my field set with my textfield
-
Best Answer Posted by Johnny Major
Looks like your listening directly on the container for the tap event. You should probably just get your textfield and set the listener directly on its element.
Something like this...
Code:initialize:function(){ var textField = this.down('textfield'); textField.element.on({ tap : function(e){ console.log('tapped text field'); } }); }
-
15 Feb 2013 11:41 AM #2
Looks like your listening directly on the container for the tap event. You should probably just get your textfield and set the listener directly on its element.
Something like this...
Code:initialize:function(){ var textField = this.down('textfield'); textField.element.on({ tap : function(e){ console.log('tapped text field'); } }); }
-
18 Feb 2013 4:17 PM #3


Reply With Quote