PDA

View Full Version : Store with LocalStorage proxy can't load



sthanabalan
17 Jan 2012, 12:29 PM
I'm having some trouble getting one of my stores to load. I keep getting a "Uncaught TypeError: Cannot read property 'id' of null" .As far as I can tell, it is setup just like other Model-Store-Proxies are in Sencha Touch 1.x, and I have successfully made other similar structures load within my app. Here is how my Model, and Store load call looks like:


App.models.Plate = Ext.regModel('App.models.Plate', {
idProperty: 'id',
fields: [
{name: 'id', type: 'int'},
{name: 'run', type: 'int', defaultValue: 0},
{name: 'plate', type: 'float', defaultValue: 0},
{name: 'coeff', type: 'float', defaultValue: 0},

proxy: {
type: 'localstorage',
id: 'plates',
},
});

var plateStore = new Ext.data.Store({
model: App.models.Plate,
storeId: 'plateStore',
});

plateStore.load(function(records, operation, success) {
console.log('loaded records :'+records.length);
});


I have double checked that the Model gets populated successfully. On launch, the app parses a csv file and populates and saves to the Model. Could it have something to do with Proxy configuration? Any help / thoughts on this are much appreciated!

Thanks,
S

mitchellsimoens
17 Jan 2012, 12:54 PM
What store is orificeStore?

sthanabalan
17 Jan 2012, 1:01 PM
Apologies, I'm actually calling plateStore.load();