Possible Duplicate:
can’t add data to jqGrid from php within json format
I am trying to load the jgqgrid with data returned from Controller Action in asp.net. I am using MVC 3 with razor view engine. I can see in in fiddler as well as firebug that the ajax request made from jqGrid is returning data but the data is not getting displayed in jqgrid. I have looked at all the related psots and answers.
I made sure that locale file is specified before the jqgrid script file.
I have tried both GET and POST and changed the action attribute accordingly in controller.
<script type="text/javascript">
$(document).ready(function () {
$("#list").jqGrid({
datatype: 'json',
url: '/Execution/GetAllExecutions/',
jsonReader: { repeatitems: true },
mtype: 'POST',
rowList: [5, 10, 20, 30],
viewrecords: true,
colNames: ['OrderID'],
colModel: [
{ name: 'OrderID', index: 'OrderID', align: 'right',key:true, width: 250}
],
pager: '#pager',
sortname: 'OrderID',
sortorder: 'desc',
height: "100%",
width: "100%",
caption: 'Orders'
});
});
</script>
<table id="list"><tr><td></td></tr></table>
<div id="pager"></div>
The format of the JSON response returned from the server don’t corresponds to
jsonReader: { repeatitems: true }which you use. You should use something like the followingMoreover would recommend you to add
loadonce: trueoption because you seems don’t implemented the paging on the server side.