PDA

View Full Version : can a SimpleStore populate from a url?



end-user
15 May 2008, 8:39 AM
... or is that not how it's intended? Not doing anything fancy, but want the valueField and displayField to come from a remote source. The examples all use a local (of obvious reasons). Do I have to define a Store obj with a reader and everything?

pokerking400
15 May 2008, 11:51 AM
This is how i get the data from sever

Hope it helps.

var mystore=new Ext.data.JsonStore({
autoLoad: true,
root:'records',
totalProperty:'totalCount',
fields:["id","name"],
url:'server url',
params: {},
id:"id",
});
mystore.load();

devnull
15 May 2008, 12:13 PM
Reading from a remote source requires a proxy (usually http proxy), and of course a reader for whatever data format chosen (json or xml). JsonStore is of course a preconfigured store that contains an http proxy and a json reader.

end-user
16 May 2008, 3:05 AM
Thanks, pokerking - that's exactly what I was looking for. I was also looking at the community manual, and there's some examples of more complex data requests. I think it would be helpful if there was an example of what the format of the data sent should be.

Thanks!