PDA

View Full Version : Load jsonStore problem



flibardi
21 Jun 2010, 9:29 PM
Hi,

I'm trying loads some vars for my app by this way:


var user = new Ext.data.JsonStore({
url: '../JSON/user.php',
root: 'usuario',
totalProperty: 'count',
fields: [{ name: 'id_login' },
{ name: 'name' }]
});

Ext.onReady(function(){

user.load({ params: { id: 1}});
Ext.Msg.alert('json', user.getAt(0).data['name']);

});

Firebug show "user.getAt(0) is undefined"

But, if i delete Ext.Msg.alert('json', user.getAt(0).data['name']); from the code and use this in firebug console, work

Why "user.getAt(0) is undefined" after user.load?

Please help me, sorry my english.

tryanDLS
22 Jun 2010, 11:09 AM
Please read http://extjs.com/learn/Ext_FAQ

Store load is async.