jquery – jqGrid在尝试加载json时发出异常

前端之家收集整理的这篇文章主要介绍了jquery – jqGrid在尝试加载json时发出异常前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的网站中有以下html:
<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>

现在当这个加载网格显示正确的列,然后显示加载消息.然而,它永久地卡在装载部分.打开chrome控制台会显示以下错误

Uncaught TypeError: Cannot read property '0' of undefined in jquery.jqGrid.min.js:14

这是jqGrid请求的我的网络服务器返回的Json:

{
  "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",{"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",{"id":"30","version":"4.16.1.1","name":"4.16 Release","date":"2010-07-30"}
  ]
}

为什么我得到这个例外?

解决方法

@H_403_17@ 你应该包括
jsonReader : { repeatitems: false }

在jqGrid参数中.

原文链接:https://www.f2er.com/jquery/176497.html

猜你在找的jQuery相关文章