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,411
    Answers
    3898
    Vote Rating
    1290
      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!

    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
    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,411
    Answers
    3898
    Vote Rating
    1290
      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!

    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.

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
  •