View Full Version : JsonStore not loading

3 Jun 2009, 11:20 AM
Hi, I'm an Ext noob. I'm trying to load up a JsonStore with values from my db.

var data = new Ext.data.JsonStore({
autoLoad: true,
url: 'proxy/projects_json.php',
root: 'projects',
fields: ['id','name']

console.log('data count: ',data.getCount());
The console shows a count of 0. My proxy returns


so I would think my count should be 2.

This seems like it should work to me, and I've been scouring tutorials, forums, and the docs all morning trying to solve this one. It's probably something stupid/simple/obvious that I'm missing? Can anyone point it out for me?

Oh, in firebug, it does show the request being sent to the proxy, and the correct (I think) response shown above.

Thanks :)

3 Jun 2009, 11:35 AM
Grid FAQ (http://extjs.com/learn/Ext_FAQ_Grid#Store_appears_empty_even_after_calling_load.28.29)

3 Jun 2009, 11:58 AM
thx, I thought it was something like that. I'll have to do some reworking... :-?

3 Jun 2009, 12:47 PM
Store load is asynchronous. A getCount() call straight after as you have will return 0 until the store loads. Put a getCount() call in the load listener if you want to see the count (or use Firebug).