preyz
8 May 2011, 9:44 AM
I'm trying to replicate Cookie-functionailty with a LocalStorage. For this purpose I have a Model called "Cookie" and a Store called "app.stores.cookies". When I try to load() the store with saved data, it returns the following error: TypeError: Result of expression 'rawData' [null] is not an object.
Ext.regModel('Cookie', {
fields: ['id', 'value'],
proxy: {
type: 'localstorage',
id: 'cookies'
}
});
app.stores.cookies = new Ext.data.Store({
model: "Cookie",
});
// No data stored => No error...
app.stores.cookies.load();
// Add an entry...
app.stores.cookies.add({id:key, value:value});
// Page-reload or next visit to page. I want to retrieve the data, but get the error mentioned above.
app.stores.cookies.load();
It is possible to work around this, by using another field (for example call it "key") and filters when accessing the stored data. However, this defeats the purpose of non-integer ID's, which should work just as fine.
Ext.regModel('Cookie', {
fields: ['id', 'value'],
proxy: {
type: 'localstorage',
id: 'cookies'
}
});
app.stores.cookies = new Ext.data.Store({
model: "Cookie",
});
// No data stored => No error...
app.stores.cookies.load();
// Add an entry...
app.stores.cookies.add({id:key, value:value});
// Page-reload or next visit to page. I want to retrieve the data, but get the error mentioned above.
app.stores.cookies.load();
It is possible to work around this, by using another field (for example call it "key") and filters when accessing the stored data. However, this defeats the purpose of non-integer ID's, which should work just as fine.