PDA

View Full Version : Read an Array inside JSON



voodoov
13 Mar 2012, 12:24 AM
Hi,

I have a JSON/Array file like this:

{
success: true,
myData: {
'myData-001': [
[ 1, 1001, 1.5 ],
[ 2, 1002, 2.5 ],
[ 3, 1003, 3.5 ]
],
'myData-002': [
[ 1, 1001, 1.5 ],
[ 2, 1002, 2.5 ],
[ 3, 1003, 3.5 ]
]
}
}

How can I read it and load it into the Grid (myData-001 in Grid1 and myData-002 in Grid2)?

These are configs that doesn't work for me:

root: 'myData-001' or 'myData' (Reader)

fields: [
{name: 'a', mapping: 1},
{name: 'b', mapping: 2},
{name: 'c', mapping: 3}
] (Model)

columns = [
{header: 'A', dataIndex: 'a'},
{header: 'B', dataIndex: 'b'},
{header: 'C', dataIndex: 'c'}
] (Grid)

Thank you in Advance.

chramer
13 Mar 2012, 1:57 AM
(Reader)

root: 'myData["myData-001"]' //for the first grid store
root: 'myData["myData-002"]' //for the second grid store
(Model)
fields : ['0','1','2']

(Grid)

columns = [
{header: 'A', dataIndex: '0'},
{header: 'B', dataIndex: '1'},
{header: 'C', dataIndex: '2'}
]

voodoov
13 Mar 2012, 2:15 AM
Thank you chramer,
You always help me! :)

chramer
13 Mar 2012, 2:28 AM
You are welcome..
I'm watching you :D