Results 1 to 8 of 8

Thread: localstorage duplicates in browser's inspect element

  1. #1
    Sencha User riyaad's Avatar
    Join Date
    Jul 2011
    Location
    Cape Town
    Posts
    245
    Answers
    6
    Vote Rating
    2
      0  

    Default Answered: localstorage duplicates in browser's inspect element

    Hi guys,I have a form that saves user settings to localstorage. After some reading and testing here and there, I got the information saved to localstorage. I've noticed though that there's more than one "instance" when using "Inspect element" in Chrome and Safari. I've attached a picture...in the red area?, is this normal?sample.jpgRegardsR

  2. It's the sync method not save.

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

    Default

    It's normal if you add a record. If you updated the first record then it should only update the one not add another.
    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 riyaad's Avatar
    Join Date
    Jul 2011
    Location
    Cape Town
    Posts
    245
    Answers
    6
    Vote Rating
    2
      0  

    Default Oh ok ...so ...

    Hi Mitchell

    I see the error ..

    Everytime I clicked 'Save' I run ..
    Code:
    userStore.add(formPanel.getValues());
    hence creating the new instance of the localstore.

    That said though, I'm assuming it should be more like

    Code:
    userStore.save(); // is this correct?
    Also .. I how does one do the equivalent of

    Code:
    document.write(localStorage.getItem("name"));
    in Sencha Touch?

    Thx for your guys great work.

    Riyaad

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

    Default

    It's the sync method not save.
    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.

  6. #5
    Sencha User riyaad's Avatar
    Join Date
    Jul 2011
    Location
    Cape Town
    Posts
    245
    Answers
    6
    Vote Rating
    2
      0  

    Default great

    thank you

    how does one retrieve one's values from the localstore though?

  7. #6
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Answers
    3885
    Vote Rating
    1297
      0  

    Default

    load the store.
    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.

  8. #7
    Sencha User riyaad's Avatar
    Join Date
    Jul 2011
    Location
    Cape Town
    Posts
    245
    Answers
    6
    Vote Rating
    2
      0  

    Default thx but ...

    Thanks, I tried this on a button ...it returned data

    Code:
                    handler: function() {
                        var test = userStore.load();
                        Ext.Msg.alert('Store Values:', test.age);
    
    
                    }
    although if I save my info (from a form) as

    Code:
    userStore.add(formPanel.getValues());
    should I not be able to get individual fields back instead of everything that's been saved in json format?

  9. #8
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Answers
    3885
    Vote Rating
    1297
      0  

    Default

    Loading the store means it will return all the records saved.
    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
  •