Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
jsonReader Setting root to a child
30/06/2008
10:34
Avatar
emeade
New Member
Members
Forum Posts: 2
Member Since:
17/06/2008
sp_UserOfflineSmall Offline

The data in my json is actually at a child level: query/data.
I have defined a custom jsonReader but I'm not sure
how or if it is possible to specifiy the root
when it is a child of another node.

The reader seems to be working because the pager is displaying
the correct values but the grid is not displaying any data rows.
Firebug does not generate any errors.
I've tried root:”DATA”, root:”QUERY[1]” and neither works.
I'm a bit of a json newbie so they are mainly guesses.

Here is my jsonReader:

jsonReader: {root:"DATA",
            page:"CURRENTPAGE",
            total:"TOTALPAGES",
            records:"TOTALRECORDS",
            cell:"",
            id:"0"
            }

And here is my json (generated via Coldfusion returnformat=”json”)

{"CURRENTPAGE":1.0,
"QUERY":{
    "COLUMNS":["HOUSEHOLDID","HOUSEHOLDNAME","FULLADDRESS","CREATEDATEFORMATED","LASTUPDATEDFORMATED","HOUSEHOLDTYPE"],
    "DATA":[
        ["001","dfdsf","sdfsfsdfsdf","05\\/13\\/0810:05:00","05\\/13\\/0810:05:00","Individual Household"],
        ["002","sdff","sfddsf","04\\/14\\/0811:07:00","04\\/14\\/0811:07:00","Family Foster Care"],
        ["003","sdfdsf","sdfsdfsdf","05\\/07\\/0813:02:00","05\\/07\\/0813:02:00","Family Foster Care"],
        ["004","sdffd","sdfsdfsdf","10\\/11\\/0700:33:00","10\\/11\\/0700:33:00","Individual Household"],
        ["005","ssddfdf","sdfsdffdfsd","10\\/19\\/0700:20:00","10\\/19\\/0700:20:00","Individual Household"],
        ["006","sdfdsfdf","sdfsdfsdfdfs","10\\/19\\/0701:10:00","10\\/19\\/0701:10:00","Individual Household"],
        ["007","sdfsdfsdf","1ssdfsdfsdfdsffd","10\\/19\\/0701:40:00","10\\/19\\/0701:40:00","Individual Household"],
        ["008","sdfsdff","sdfsdsdfdfs","11\\/15\\/0714:54:00","11\\/15\\/0714:54:00","Individual Household"],
        ["009","sdsdfsf","sdfsdfsdf","01\\/02\\/0800:47:00","01\\/02\\/0800:47:00","Individual Household"],
        ["010","sfsddf","sdfsdfsdfsdf","01\\/02\\/0801:25:00","01\\/02\\/0801:25:00","Individual Household"]
        ]
    },
"TOTALRECORDS":41,
"TOTALPAGES":10.0}

30/06/2008
12:13
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

I think that your json is not well formated for use of jqGrid

if possible try this

jsonReader: {root:”DATA”,
            page:”CURRENTPAGE”,
            total:”TOTALPAGES”,
            records:”TOTALRECORDS”,
            cell:”",
            id:”0″
            }

and the json sholuld be

{”CURRENTPAGE”:1.0,
“QUERY”:{
    “COLUMNS”:["HOUSEHOLDID","HOUSEHOLDNAME","FULLADDRESS","CREATEDATEFORMATED","LASTUPDATEDFORMATED","HOUSEHOLDTYPE"],
    “DATA”:[
        {"001","dfdsf","sdfsfsdfsdf","05\\/13\\/0810:05:00","05\\/13\\/0810:05:00","Individual Household"},
        {"002","sdff","sfddsf","04\\/14\\/0811:07:00","04\\/14\\/0811:07:00","Family Foster Care"},

.....

Note the replacement of [] with {}

In the docs there is such example

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.

30/06/2008
13:54
Avatar
emeade
New Member
Members
Forum Posts: 2
Member Since:
17/06/2008
sp_UserOfflineSmall Offline

Thanks. I didn't even see that.

The unfortunate thing is I'm using a built in function of Coldfusion and that is the way it is doing the formatting.

I guess I'll have to write my own.

01/07/2008
01:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

DataTypes->JSON Data->JSON - somewhere in the middle of the page

Reagrds

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
63 Guest(s)

Currently Browsing this Page:
1 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information