-
2 Dec 2012 5:20 PM #1
Answered: How to add longpress event to text field?
Answered: How to add longpress event to text field?
Hello,
Im trying to add a longpress event to a text field, but it's not firing.
What am I doing wrong.
Code:items: [ { xtype: 'textfield', name : 'SCSCOD', id : 'SCSCOD', value: SCSCOD, label: 'Shipper Code', useClearIcon: true, listeners: { longpress: function() { alert('touched this'); } } },{
-
Best Answer Posted by mitchellsimoens
Something like:
Code:new Ext.form.FormPanel({ fullscreen : true, items : [ { xtype : 'textfield', label : 'Test', listeners : { element : 'el', taphold : function() { console.log('tap'); } } } ] });
-
3 Dec 2012 8:33 AM #2
Ps. I cant get any event to fire at all. Am I able to put a listener on a textfield?
Thank You ...
-
4 Dec 2012 7:19 AM #3Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,661
- Vote Rating
- 435
- Answers
- 3109
longpress is on the element not the component itself.
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.
-
4 Dec 2012 8:17 AM #4
Im not sure what that means. Can you give me an example, please.
-
4 Dec 2012 8:41 AM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,661
- Vote Rating
- 435
- Answers
- 3109
Something like:
Code:new Ext.form.FormPanel({ fullscreen : true, items : [ { xtype : 'textfield', label : 'Test', listeners : { element : 'el', taphold : function() { console.log('tap'); } } } ] });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.
-
4 Dec 2012 8:59 AM #6
That worked but I dont understand the difference.
I had used element: 'element', and it didnt work
Thank You very much ...
-
4 Dec 2012 9:01 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,661
- Vote Rating
- 435
- Answers
- 3109
element : 'element' is the ST 2 way of listening on the element, in ST 1, it's just 'el'. Think of it as a property on the component (not really as such but will work mostly)
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.
-
4 Dec 2012 9:13 AM #8
coolBeans ...
You da man Mitch


Reply With Quote