1. #1
    Sencha User ksumarine's Avatar
    Join Date
    Feb 2012
    Posts
    16
    Vote Rating
    0
    ksumarine is on a distinguished road

      0  

    Exclamation Answered: Pass variable to app.js

    Answered: Pass variable to app.js


    Hi,

    I have an app that has two html pages. The first being index.html, has 5 images that gives instructions to the user about the app itself. The second html page is where all the sencha touch code is (app.js, etc). Depending on which image you tap on the first page, it passes a variable to the second and activates a corresponding tab.

    So...

    Image one > tabs.html?tabid=0 > activates the first tab
    Image two > tabs.html?tabid=1 > activates the second tab

    Etc...

    Is this possible? I would imagine I need to use setActiveTab() with the passed variable, but I can't get it to work. Any help would be very much appreciated.

    Thanks!

  2. Why don't you design the start page using Sencha Touch, too?

    But anyway, if you don't want to do that, you can use window.location.href and Ext.Object.fromQueryString to parse the options into a javascript object.

    edit: you could also use the hash url notation: page.html#page-1 and get that value via window.location.hash or just use the routes feature included in ST

  3. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Answers
    102
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I'm very confused as to why anyone would want to do this.

  4. #3
    Sencha User ksumarine's Avatar
    Join Date
    Feb 2012
    Posts
    16
    Vote Rating
    0
    ksumarine is on a distinguished road

      0  

    Default


    Because the first page is going to be used as instructions with descriptions about each tab for the user. Also, it serves as a quick access point to the information they need.

    I understand that you may be confused, but is it possible?

  5. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    49
    Answers
    6
    Vote Rating
    0
    j.k is on a distinguished road

      0  

    Default


    Why don't you design the start page using Sencha Touch, too?

    But anyway, if you don't want to do that, you can use window.location.href and Ext.Object.fromQueryString to parse the options into a javascript object.

    edit: you could also use the hash url notation: page.html#page-1 and get that value via window.location.hash or just use the routes feature included in ST

  6. #5
    Sencha User ksumarine's Avatar
    Join Date
    Feb 2012
    Posts
    16
    Vote Rating
    0
    ksumarine is on a distinguished road

      0  

    Default


    Excellent, Ext.Object.fromQueryString worked perfectly. Thanks!