Results 1 to 4 of 4

Thread: Best use of Ext.Router.draw() with data

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    111
    Answers
    5
    Vote Rating
    1
      0  

    Default Answered: Best use of Ext.Router.draw() with data

    I am using the Ext.Router.draw() method to create deep links in my Sencha Touch project. When the user performs an action that will take them to the next page, I save my data to either sessionStorage or localStorage and then do a window.location = "#nextPage";
    The action that is fired retrieves the data from the session and creates the page. This is nice because I am able to refresh the page midway through a flow without lossing state.

    I was wondering if Sencha provides a better way to do to pass data when changing the hash.

    Thanks

  2. There is no pairing like that between a hash and data.

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

    Default

    There really isn't any other way. Challenge is if someone types in that link, what happens...
    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
    111
    Answers
    5
    Vote Rating
    1
      0  

    Default

    I redirect the user back to the defaultUrl if they do not have everything they need in session or localStorage. I was thinking there could be a function like,

    Ext.dispatch({
    location:'#nextPage',
    data:theData
    });

    Then when the action fires, you have access to the data by doing options.data. There could also be a proxy added to define where it should be stored (memory, localStorage, sessionStorage). This would save me from encoding and decoding all the time.

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

    Default

    There is no pairing like that between a hash and data.
    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

Tags for this Thread

Posting Permissions

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