I have the json below and I am trying to get is display onto my jqgrid. I have the following jsonReader
jsonReader : {
repeatitems: false,
root: "abc",
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.length; }
},
column model:
colModel:[
{name:'num'},
{name:'seq'},
{name:'status'},
{name:'transTime'},
{name:'sd'},
{name:'total'},
{name:'xys'}
],
Json:
{
"xys": 3,
"abc": [
{
"time": null,
"num": "1234",
"seq": 2,
"status": "X",
"transTime": null
},
{
"time": null,
"num": "4567",
"seq": 1,
"status": "Y",
"transTime": null
}
],
"sd": "7895",
"total": 5
}
only the num, seq and status got populated with data, but not transTime, sd, total and xys
any ideas and pointer?
If you have to read the JSON data and can't change the data on the server side you can makes small transformation of the data returned from the server on the client side inside of beforeProcessing
callback. The demo do this and displays the following results
It uses the following code
loadonce: true,
jsonReader: { root: "abc" },
beforeProcessing: function (data) {
var root = data.abc, i, item, cItems = root.length;
for (i = 0; i < cItems; i++) {
item = root[i];
item.sd = data.sd;
item.id = $.jgrid.randId();
item.total = data.total;
item.xys = data.xys;
if (item.transTime === null) {
item.transTime = "null";
}
}
}