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

    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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    There really isn't any other way. Challenge is if someone types in that link, what happens...
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    111
    Answers
    5

    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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    There is no pairing like that between a hash and data.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    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
  •