-
15 Apr 2012 5:44 PM #1
Answered: Focus Field on Load?
Answered: Focus Field on Load?
I'm trying to convert a JQM app to Sencha. The app places focus automatically on the only text input on the panel, so a user can use a barcode scanner to scan and retrieve information.
Any ideas how to simply get this going on ST2?
-
Best Answer Posted by mitchellsimoens
You need to get the component instance. Once you have that then you can execute focus() ont hat instance. http://docs.sencha.com/touch/2-0/#!/...t-method-focus
-
16 Apr 2012 5:29 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
Mobile devices do not act uniformly when trying to focus on a field. YOu can try to execute focus() on the field.
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.
-
16 Apr 2012 8:42 AM #3
I've actually had fairly good luck across the devices we use for these tools. Of course, I always understand that nothing will ever work perfectly across all form factors.
I'd like to execute focus, but perhaps I'm not understand how to execute against what I'm asking ST2 to create in the DOM. In JQM, $('input#fScan').focus(); does what I need it to do, but if I am creating:
{
xtype: 'textfield',
name: 'scan'
}
I guess I'm not sure where to place the focus execution because I'm not sure when or where it would be appropriate...or if this is done within Sencha's nomenclature or outside of it.
-
16 Apr 2012 8:46 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
You need to get the component instance. Once you have that then you can execute focus() ont hat instance. http://docs.sencha.com/touch/2-0/#!/...t-method-focus
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.
-
16 Apr 2012 8:49 AM #5


Reply With Quote