PDA

View Full Version : [FIXED]LocalStorage Proxy: rawData is null



bzarzuela
24 Feb 2011, 12:47 AM
I'm using the fix:



Ext.data.Model.override({
getProxy: function(){
return this.self.proxy;
}
});




Ext.regModel('User', {
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'},
{name: 'age', type: 'int'},
{name: 'eyeColor', type: 'string'}
],
proxy: {
type: 'localstorage',
id: 'users'
}
});

new Ext.data.Store({
model: 'User',
storeId: 'UserStore',
autoLoad: true
});

var grid = new Ext.grid.GridPanel({
title: '',
store: 'UserStore',
headers: [
{ text: 'First Name', dataIndex: 'firstName'},
{ text: 'Last Name', dataIndex: 'lastName'}
]
});

var win = new Ext.Window({
title: 'Webtool List',
width: 400,
height: 300,
layout: 'fit',
items: [grid],
buttons: [
{
text: 'Add Random',
handler: function () {
var user = Ext.ModelMgr.create({
firstName: 'Bryan',
lastName: 'Zarzuela',
age: 29,
eyeColor: 'Black'
}, 'User');
user.save();
}
}
]
});

win.show();



When I click save for the first time, no error. However, when you reload the page and the store tries to load the data from localStorage, this comes up:

rawData is null
http://ext4test.teleserv.mac:8080/ext/ext-all-debug.js
Line 28519

The previous call from getRecord has a parameter called id with a value of NaN

bzarzuela
24 Feb 2011, 12:51 AM
24829

Here's the output of console.dir(window.localStorage);

Disregard the users1, I tested renaming the store's ID while debugging.

evant
24 Feb 2011, 5:13 AM
I believe this is already resolved. Can you try with the next preview release when it comes out?

Thanks.