PDA

View Full Version : JsonStore public methods not responding as I'd expect



jharsem
19 Oct 2010, 2:49 PM
HI guys,

I am sure this is something trivial that I am just missing:

I have:

wickeddigital.ui.SpecialsPanel = Ext.extend(Ext.Panel, {

initComponent : function() {
this.layout = {
type: 'card'
};
fullscreen:true;

var store = new Ext.data.JsonStore({
storeId:'specialStore',
proxy: {
type: 'ajax',
url: 'http://localhost/~jharsem/wicked/specials.json',
reader: {
idProperty: 'id',
type: 'json',
root: 'specials'
}
},
fields: ['imgs','text']
});

store.load();
Ext.getBody().unmask();

wickeddigital.ui.SpecialsPanel.superclass.initComponent.call(this);
console.log(store);
}
});

Ext.reg('wd-specialspanel', wickeddigital.ui.SpecialsPanel);

The console log does show me that there is data in the store and that it seemed to load - yet
if I try to store.getAt("1") or store.getCount() I end up with undefined and 0. Where am I going wrong ?
(apologies if this is trivial and I am just missing it)

jharsem
19 Oct 2010, 2:57 PM
Argh .. found my error 30 seconds after the post - I needed to use/wait for the dataChanged event. Apologies.