PDA

View Full Version : Load object from localStore



Zielke
21 Sep 2010, 12:00 AM
Hi everybody,

i want to make a json result offline available. So i saved the callback result like...


log(value) // [Object, Object, ..., Object]
log(typeof value) // it´s an object
localStorage.setItem('storeName', value);
... but after i load it, it is like ...


var value=localStorage.getItem('storeName');
log(value) // [object Object],[object Object], ..., [object Object]
log(typeof value) // now it´s a string

Is there a way to realize that?

axxerion
21 Sep 2010, 12:06 AM
if you use the Store framework from Sencha, it will encode the object itself... if you are using the windows.localStorage directly, you must encode the object yourself by using Ext.decode/Ext.encode when saving and retrieving...