Forum


15:30

04/09/2010

Hi, I'm having problems getting JSON data to display in the grid. I've checked forum topic No data is displaying in my grid but I didn't understand how it's work. Unfortunataly page Demo->Data Optimization does not contain grid which should be use example json ( smaller data).
Would someone please help figure out how to setup jsonReader and colModel mapping.
jQuery("#DataGrid").jqGrid({
datatype: "local",
height: 'auto',
width:450,
rowNum:100,
colNames:['date','count'],
colModel:[ {name:'date',index:'date', width:100}, {name:'count',index:'count', width:100} ], multiselect: true,
jsonReader : {
root: function (obj) { return obj.data;},
cell: function (obj) { return obj; },
id: function (obj) { curId++; return curId; },
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.data.length; }
}, caption: "Manipulating Array Data" });
function LoadGridTest(datasets) { for(var i=0;i<=datasets.length;i++) { jQuery("#DataGridTest").jqGrid('addRowData',i+1,datasets[i]); } }
LoadGridTest(datasetTest);
This is code does not work. Is it possible to call to the required field in the ColModel via data[0] ->1277942400000, and data[1] -> 11.
My existing json data look like :
"Content (Created)":{"label": "Content (Created)", "data": [[1277942400000, 11], [1278028800000, 1]]},
"Content (Modified)":{"label": "Content (Modified)", "data": [[1277942400000, 10], [1278028800000, 15]]}
}
Is it possible to create jsGrid look like (How to configure jsonReader and colModel mapping ):
|Lable |Date |Count|
————————————————–
|Content (Modified)|1278028800000|15|
|Content (Modified)|1277942400000|10|
|Content (Created) |1278028800000|1 |
|Content (Created) |1277942400000|11|
Any help will be appreciated.
Thanks.
Most Users Ever Online: 715
Currently Online:
53 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66