Results 1 to 5 of 5

Thread: Focus Field on Load?

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default 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?

  2. 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

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Mobile devices do not act uniformly when trying to focus on a field. YOu can try to execute focus() on the field.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default

    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.

  5. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  6. #5
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Awesome thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •