View Full Version : multiple json roots

17 Aug 2010, 9:44 AM
Forgive me if this have been covered, but....

I have a main record that has transactional records associated with it. The JSON is as follows:

{'order':'000000','line':[{ 'licnt':'1','prod':'widgit-1'},{'licnt':'2','prod':'widgit-2'}]},
{'order':'000001','line':[{ 'licnt':'1','prod':'widgit-1'},{'licnt':'2','prod':'widgit-2'},{'licnt':'3','prod':'widgit-3'}]}

This is to be rendered in a grid. I would like the 'lines' with be rendered within a template.

Since the renderer only passes the data from 'line', I can't use a json reader (since it isn't).
I know I must be approaching this from the wrong angle.

Do I need to create my own reader for the entire record?
Can I create a simple store with the 'line' items just before rendering?

Any hints?

17 Aug 2010, 10:10 AM
The root config can be a function which returns the root array from the raw data object.

So you can put together the array of row objects yourself to be then read by the reader.

17 Aug 2010, 10:56 AM
So if I'm reading (no pun) that correctly, I must define my own reader for the entire store?

I'm just not sure how to handle the 'lines' when there will be a varying number of them.

Is that correct?