Forum


14:23

28/12/2009

Hi
I'm trying to use the dot notation in my json reader to access data.
This json looks like this:
The jsonreader tries to acces the "p" list with this:
root:"t1.p",
page: "currpage",
total: "totalpages",
records: "totalrecords",
repeatitems: false,
id: "0"
},
But I get parser error. Is it possible to use the dot notation like that?
Thanks
x
09:44

Moderators
30/10/2007

Hello,
This will not work.
In root element you can not set a dot notations - i.e root:"t1.p" will not work
Try to set the root to "match" item and then in colModel set for the field the dot notation.
Example
colModel : [
....
{name:"some"... jsonmap: "t1.xxx"...}
...
]
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
20:51

I tried something similar, it didn't work.
The root is not "match" because match is nested, and the grid never sees the actual node it needs to recurse over, because it's nested. The grid just comes up blank. If I unnest/flatten the row data to a top level tree member, grid works great.
So I don't think this solution works, seems to me this should be a feature of the grid, to see inner data nodes in JSON data.
Has anyone here actually tried this to see what happens?
Is there any other discussion of this subject I might have missed?
If I was going to write a solution, how best to go about it?
thx!
21:27

I'm incorrect, the example above might work, but my data is a little different, as below.
because "cart" iis the main datanode (but is not an array), I set root to cart, but json map does not see the "contents" node below it:
{
"cart":
{
"nextId":null,
"viewName":null,
"contents":
[
{"id":"209660059","type":"food","quantity":"3"},
{"id":"209661059","..
COLUMN MODEL:
colModel:[
{name:'contents.id',index:'contents.id',jsonmap: 'contents.id'},
{name:'contents.type',index:'contents.type',jsonmap:'contents.type'},
{name:'contents.quantity',index:'contents.quantity',jsonmap:'contents.quantity'}
]
jsonReader : {
root: "portfolio",
repeatitems: false,
...
},
I've tried several variations of this, none seem to work for me, does this look like it should work?
Grid comes up empty with no issues in the FBug console.
21:53

Sorry,
I know how to set the jsonReader correctly but did not do so in my simplified example for forum use:
jsonReader : {
root: “cart”,
repeatitems: false,
…
},
still doesn't work, I assume because "cart" is not an array that can be recursed through; looks like nested json arrays are hidden
from the grid entirely unless there is some way to map to them but I can't find anything that works for out-of-the-box config....
still I thought maybe it would see first row, but nothing.
If I need to write custom code, would appreciate some guidance as to how that might best work..
get and process JSON first, prune, submit to grid as object? hum...
18:33

Moderators
30/10/2007

Hello,
Could you please send me the grid configuration and json response.
Thanks
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
54 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66