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
json reader
30/12/2009
10:46
Avatar
xworker
Member
Members
Forum Posts: 9
Member Since:
28/12/2009
sp_UserOfflineSmall Offline

Hi all

I'm having trouble with getting my json reader to work. This is the example output from my server:

{"page":"1","total":1,"records":"3","rows":[{"1","a","b","c","0"},{"2","aa","bb","cc","0"},{"3","aaa","bbb","ccc,"0"}]}

My jsonreader is like this:

  jsonReader : {
        root: "rows",
        page: "page",
        total: "total",
        records: "records",
        repeatitems: false,
        id: "0"

    },

Can someone see whats wrong?

Thanks

/x

30/12/2009
10:52
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Set repeaitems to true. Please read the docs before posting

http://www.trirand.com/jqgridw.....#json_data

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.

30/12/2009
11:07
Avatar
xworker
Member
Members
Forum Posts: 9
Member Since:
28/12/2009
sp_UserOfflineSmall Offline

I have read the docs. The say I should set it to false? I cant get the example below to work either…

http://www.trirand.com/jqgridw.....#json_data

jQuery(“#gridid”).jqGrid({

jsonReader : {
root:“invdata”,
page: “currpage”,
total: “totalpages”,
records: “totalrecords”,
repeatitems: false,
id: “0″
},

});

The resulting data in our example should be:

{
totalpages: “1″,
currpage: “1″,
totalrecords: “2″,
invdata : [
{invid:"1",invdate:"cell11", amount:"cell12", tax:"cell13", total:"1234", note:"somenote"},
{invid:"2",invdate:"cell21", amount:"cell22", tax:"cell23", total:"2345", note:"some note"}
]
}

My script for displaying the data above:


jQuery(”#table”).jqGrid ({
url:'stats?player=x',
datatype : 'json',
mtype:'POST',

colNames:['invid','invdate','amount','tax','total','note'],
colModel : [
{name:'invid', width:30, sortable:true, align:'center'},
{name:'invdate', width:40, sortable:false, align:'center'},
{name:'amount', width:180, sortable:true, align:'left'},
{name:'tax', width:380, sortable:true, align:'left'},
{name:'total', width:0, sortable:false, align:'center'},
{name:'note', width:0, sortable:false, align:'center'}
],
sortname: “invid”,
sortorder: “asc”,
pager: '#pager',
rowNum:15,
rowList:[15,30,50],
caption: 'example',
viewrecords:true,

jsonReader : {
root:”invdata”,
page: “currpage”,
total: “totalpages”,
records: “totalrecords”,
repeatitems: false,
id: “0″
},

width: 700,
height: 200
});

Doesnt work. Thanks for helping.

/x

30/12/2009
11:25
Avatar
xworker
Member
Members
Forum Posts: 9
Member Since:
28/12/2009
sp_UserOfflineSmall Offline

I think I got it. It was how the json was outputed on the server. I was missing some ".

Thanks for all the help.

/x

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
50 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