My jqGrid definition is
.
.
.
datatype: 'json', //We specify that the datatype we will be using
url:'<%=request.getContextPath()%>/servlet/AjaxManager?mode=9999&beginindex=0&totallimit=10&colname=policyname&sorttype=asc', // that will return the data
colNames:['Policy Name','Policy Type', 'Time allowed (HH:mm)','Expiration Duration (days)','Session Pulse(minutes)','Description'], //Column Names
colModel :[
{name:'policyname', index:'policyname', editable:true,sorttype:'text',width:150,editoptions:{size:30,maxlength:50}, frozen : true,editrules:{required:true},formatter:'showlink',formatoptions:{baseLinkUrl:'javascript:' , showAction: "GetAndShowUserData(jQuery('#list2'),'",addParam: "');"}},
{name:'policytype', index:'policytype', sorttype:'text',editable:true,edittype:"select",editrules: {edithidden:true},editoptions:{value:"POST:Postpaid;PRE:Prepaid"}},
{name:'allotedminutes', index:'allotedminutes',resizable:false, sorttype:'text',editable:true,width:200, align:"right",editoptions:{size:10}},
{name:'expiredays', index:'expiredays', sorttype:'text',editable:true,width:200, align:"right",editrules:{integer: true},editoptions:{size:5, maxlength:4}},
{name:'sessionpulse', index:'sessionpulse',sorttype:'int',editable:true,width:200, align:"right"},
{name:'policydescription', index:'policydescription', sortable:false,editable:true,sorttype:"date"}],
.
.
.
jsonReader : {
root: "ROWS", //our data
page: "CURRENTPAGE", //current page
total: "TOTAL", //total pages
repeatitems: true,
id: "id",
cell: "cell",
userdata:"USERDATA", //Userdata we will pass back for feedback
records: "TOTALRECORDS" //total records
},
.
.
.
And my JSON value is
{"TOTAL":1,"CURRENTPAGE":1,"TOTALRECORDS":1,"ROWS":[{"id":1,"cell":["Unlimited Policy","Absolute","Unlimited","Unlimited",1,"2007-12-03"]},{"id":2,"cell":["1 Month Unlimited policy","Absolute","Unlimited",30,1,"2007-12-03"]},{"id":3,"cell":["100 Hours policy","Absolute","100:00","Unlimited",1,"2007-12-03"]}]}
But I am not able to load that JSON data into jqGrid. Here jqGrid is showing any records in the grid.
How you can see from the demo the
jsonReaderwhich you use do corresponds to the data which returns the server.I suppose that you should examine the
Content-Typeheader of the server response. It should beapplication/json. I recommend you additionally to insertloadErrorcallback to see which error was the reason of the empty grid. See the answer for more details.