Hi,
I'm trying to use localstorage proxy for my models, but for some reason after each page refresh I have empty data.
I'm debuging in google chrome + ripple, and inside the "Storage" tab, I can see all data I saved. But when I trying to read it - data is empty.
Here the code:
controllers/Main.js:
Code:
launch: function() {
var optionsStore = Ext.getStore('optionsStore'),
currentType = optionsStore.getById('type'); // Is null :( I event can't call .get() because it is null.
}
Saving:
Code:
optionsStore.setData([{
key: 'type',
value: 'posts'
}]);
Reading after saving is ok.
Store and model:
Code:
Ext.define('PM.model.Option', {
extend: 'Ext.data.Model',
requires: ['Ext.data.proxy.LocalStorage'],
config: {
fields: [
{ name: 'value', type: 'auto'}
],
idProperty: 'key',
proxy: {
type: 'localstorage',
id: 'options'
}
}
});
Ext.define('PM.store.Options', {
extend: 'Ext.data.Store',
config: {
model: 'PM.model.Option',
storeId: 'optionsStore',
autoSync: true
}
});
Maybe I miss some addiitonal initialization code?
Thanks and sorry for my bad english