PDA

View Full Version : json data store, simply showing a msg box



chrizmaster
19 Mar 2009, 7:39 AM
Hi out there,

I have this code:



Ext.ux.io.db.testdb = function(p_params){

var RecordDef = Ext.data.Record.create([
{name: 'name'},
{name: 'filename'}
]);

var myReader = new Ext.data.JsonReader({
totalProperty: "itemCnt",
root: "data",
id: "id"
}, RecordDef);


var store = new Ext.data.Store({
nocache : true,
reader : myReader,
autoLoad : true,
remoteSort : true,
baseParams: Ext.ux.io.db.clSetwallpaper ,
proxy : new Ext.data.HttpProxy({
url : cfg.dbconnector,
method : 'POST'
})
});

}


ARGH, I wrote this message 3 times cause I wanted to ask some questions which I finally all figured out by myself. In the end, there's just one question left:

With the code above, I am collection some json code. What I want to do no, is not to fill a grid, I'll get back a list with names and I simply want to show this list in an alert msg?

Funny, but I can't figure out how cause if i try something like: store.collect(), it seems like the store isn't finished with loading the data while i am showing the msg box :-(

mabello
19 Mar 2009, 7:47 AM
If you need to be sure that the store is completely loaded, you should process any action on your store/records using the load event.
So attach to load and manipulate your store there
Hope this helps

chrizmaster
19 Mar 2009, 8:06 AM
Hey, I got the solution, thank you.


And I am hapy to anounce my first scope problem :-)