I have the following html in my site:
<link type="text/css" href="/Styles/ui-lightness/jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
<link type="text/css" href="/Styles/ui.jqgrid.css" rel="Stylesheet" />
<script type="text/javascript" src="/Scripts/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="/Scripts/jquery-ui-1.8.2.min.js" ></script>
<script type="text/javascript" src="/Scripts/grid.locale-en.js" ></script>
<script type="text/javascript" src="/Scripts/jquery.jqGrid.min.js" ></script><link type="text/css" rel="Stylesheet" href="Styles/Site.css" />
...
<script type="text/javascript">
$(document).ready(function () {
jQuery("#tblScheduledReleases").jqGrid({
url: '/Release/GetScheduledReleases',
datatype: "json",
mtype: 'POST',
colNames: ['Id', 'Version', 'Name', 'Scheduled Date'],
colModel: [
{ name: 'id', width: 55 },
{ name: 'version', width: 90 },
{ name: 'name', width: 100 },
{ name: 'date', width: 90 }
],
autowidth: true,
sortname: 'date',
viewrecords: true,
sortorder: "desc",
caption: "Scheduled Releases"
});
});
</script>
....
<table id="tblScheduledReleases"></table>
<div id="divScheduledPager"></div>
Now when this loads the grid shows with the correct columns and then shows the Loading
message. However, it is perpetually stuck in the loading section. Opening up the chrome console shows the following error:
Uncaught TypeError: Cannot read property '0' of undefined in jquery.jqGrid.min.js:14
Here is the Json being returned by my webserver requested by the jqGrid:
{
"page":"1",
"total":"1",
"records":6,
"rows":[
{"id":"37","version":"4.14.9.1","name":"4.14 Patch 8","date":"2010-07-08"},
{"id":"39","version":"4.15.4.1","name":"4.15 Patch 3","date":"2010-07-08"},
{"id":"36","version":"4.13.11.1","name":"4.13 Patch 11","date":"2010-07-15"},
{"id":"40","version":"4.15.5.1","name":"4.15 Patch 4","date":"2010-07-22"},
{"id":"38","version":"4.14.10.1","name":"4.14 Patch 9","date":"2010-07-22"},
{"id":"30","version":"4.16.1.1","name":"4.16 Release","date":"2010-07-30"}
]
}
Why am I getting this exception?
You should include
jsonReader : { repeatitems: false }
in the jqGrid parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With