1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
    vsack is on a distinguished road

      0  

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

  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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
    vsack is on a distinguished road

      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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
    vsack is on a distinguished road

      0  

    Default


    Awesome thanks!

Thread Participants: 1