PDA

View Full Version : JsonStore:How to load jsondata "inline" [fill store programmatically]



mabra
6 Apr 2010, 12:59 PM
Hi !

I try to fill a jsonStore programmatically. But my data is a part form another json result and I try to fill my jsonStore like this:


var data = /* string like in json result; not shown, but:Via http, this data loads properly */
var jsonReader = new Ext.data.JsonReader
(
{
messageProperty: data //Tell the reader to use this data instead loading via proxy.
}
);

var store = new Ext.data.JsonStore
(
{
reader: jsonReader,
autoLoad: true,
fields: []
}
);
In this case, there is an exception:
Message: 'this.proxy' is null or not an object

So it looks for me, that the "JsonStore" ignores the direct data for the reader and tries to find a proxy, which is not necessary in my scenario. I cannot load via an array, because I also need the metadata!

I do not know/understand, what I am doing wrong here. Any help would be great!

br++mabra

ExtJSBeginner
7 Apr 2010, 6:34 AM
Maybe it helps using a MemoryProxy and let it load your data variable

Condor
7 Apr 2010, 6:37 AM
Why use a MemoryProxy? What is wrong with using the 'data' config option or the loadData() method?

mabra
7 Apr 2010, 7:59 AM
Hi,

and thanks all!

I got a bit confused this morning and accidentally lost my own track ....
It is NOT the store, it is the MetaGrid, I am using
(see here: http://www.extjs.com/forum/showthread.php?t=96373).

In the moment, I specify the MetaGrid plugin, the problem occurs.

Sorry for my wrong conclusion. If you can help me /possibly understand MetaGrid, please look at the link.

Best regards,
mabra