-
15 Mar 2012 12:48 PM #1
Answered: localstorage duplicates in browser's inspect element
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
-
Best Answer Posted by mitchellsimoens
It's the sync method not save.
-
16 Mar 2012 5:34 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3102
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 @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Mar 2012 5:43 AM #3
Oh ok ...so ...
Oh ok ...so ...
Hi Mitchell
I see the error ..
Everytime I clicked 'Save' I run ..
hence creating the new instance of the localstore.Code:userStore.add(formPanel.getValues());
That said though, I'm assuming it should be more like
Also .. I how does one do the equivalent ofCode:userStore.save(); // is this correct?
in Sencha Touch?Code:document.write(localStorage.getItem("name"));
Thx for your guys great work.
Riyaad
-
16 Mar 2012 5:56 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3102
It's the sync method not save.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Mar 2012 5:59 AM #5
great
great
thank you
how does one retrieve one's values from the localstore though?
-
16 Mar 2012 6:00 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3102
load the store.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Mar 2012 6:16 AM #7
thx but ...
thx but ...
Thanks, I tried this on a button ...it returned data
although if I save my info (from a form) asCode:handler: function() { var test = userStore.load(); Ext.Msg.alert('Store Values:', test.age); }
should I not be able to get individual fields back instead of everything that's been saved in json format?Code:userStore.add(formPanel.getValues());
-
16 Mar 2012 6:21 AM #8Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3102
Loading the store means it will return all the records saved.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote