PDA

View Full Version : Get totalProperty from JSON Reader from data



jaquet
6 Mar 2010, 5:57 AM
Hi All,

I need to get the totalProperty set up to use a column from my data. My store looks like this:

{"recordcount":2,"columnlist":"foundrows,sitedescription,siteid,siteidentifier,sitename,siteurl","data":[{"foundrows":4,"sitedescription":"Belgische site van Replace Direct","siteid":2,"siteidentifier":"rdbe","sitename":"Replace Direct BE","siteurl":"http:\/\/www.replacedirect.be"},{"foundrows":"","sitedescription":"Duitse site van Replace Direct","siteid":3,"siteidentifier":"rdde","sitename":"Replace Direct DE","siteurl":"http;\/\/www.replacedirect.de"}]}

The recordcount is 2, because of the limit in my query. But I include a foundrows in my query, that I want to use.

Right now, I have tried this:

totalProperty: 'grid.store.reader.jsonData.data[0].foundrows',

When i log that value to the console I get a proper value, but when I use it for the JSON reader, the grid does not populate, it shows the empty message...

What am I doing wrong?

Hope you can help,

Erik-Jan

jaquet
16 Mar 2010, 1:53 AM
Nobody? I still need to fix this...

Animal
16 Mar 2010, 2:00 AM
So your JSON is in fact



{
"recordcount": 2,
"columnlist": "foundrows,sitedescription,siteid,siteidentifier,sitename,siteurl",
"data": [{
"foundrows": 4,
"sitedescription": "Belgische site van Replace Direct",
"siteid": 2,
"siteidentifier": "rdbe",
"sitename": "Replace Direct BE",
"siteurl": "http:\/\/www.replacedirect.be"
},
{
"foundrows": "",
"sitedescription": "Duitse site van Replace Direct",
"siteid": 3,
"siteidentifier": "rdde",
"sitename": "Replace Direct DE",
"siteurl": "http;\/\/www.replacedirect.de"
}]
}


(How difficult is it to run it through http://jsbeautifier.org/ and post it inside code tags???)

So you want your totalProperty to be "data[0].foundrows" do you?

jaquet
16 Mar 2010, 2:04 AM
Hi,

First of all, sorry for the sloppy JSON post. I did not know of the option to run code through the website you mentioned. It is not that hard, but you have to know of this option before you can use it... Won't happen again.

And yes, I want the foundrows from my recordset to use in the totalProperty.

jaquet
16 Mar 2010, 2:08 AM
Ok, now I understand your post. I do not address the property as

'grid.store.reader.jsonData.data[0].foundrows'

but as

'data[0].foundrows'!

Thx, that worked.