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
incorrect json return for Grid
07/10/2011
14:56
Avatar
ManKesh
New Member
Members
Forum Posts: 2
Member Since:
07/10/2011
sp_UserOfflineSmall Offline

I'm trying to populate my first jqGrid by getting data from a service.  However the data I'm getting is shown below(This was output from Fiddler).

{"GetContResult":

"{"total":1,

"page":1,

"records":3,

"rows":[

{"ID":1,"PersonID":2,"Company":"","Tax":14,"Gross":64},

{"ID":2,"PersonID":3,"Company":"","Tax":22,"Gross":11},

{"ID":3,"PersonID":4,"Company":"","Tax":22,"Gross":11},

]}"}

My Code for populating the grid looks like below:

 $("#contributions").jqGrid({
        url: '../test.svc/GetContributions',
        postData: { schemeId: schemeid, personId: memberid },
        mtype: 'POST',
        dataype:'json',
//        loadonce: true,
        ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
        serializeGridData: function (GetContributionsResult) {
            return JSON.stringify(GetContributionsResult);
        },
        jsonReader: {
            root: function (obj) { return obj; },
            page: function (obj) { return 1; },
            total: function (obj) { return 3; },
            records: function (obj) { return obj.length; },
            repeatitems: false,
            id: "ID"
        },
        colNames: ["Company", "Tax", "Gross", "Net"],
        colModel: [
    { name: "Company", index: "Company", width: 150 },
    { name: "Tax", index: "Tax", width: 150 },
    { name: "Gross", index: "Gross", width: 150 }
   ],
        rowNum: 10,    
        rowList: [10, 20, 300],    
        sortname: 'Company',    
        sortorder: "asc",
        caption: "Contributions",
        width: "950″,
        pager:$("#pager"),
        viewrecords: true,    
        gridview: true,    
        rownumbers: true,
    });


At the moment nothing happens and my Grid doesn't populate, any help to push me in the right direction will be really appreciated.

Thanks in advance

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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