gpt4 book ai didi

jquery - 尝试加载 json 时 jqGrid 给出异常

转载 作者:行者123 更新时间:2023-12-03 22:23:16 27 4
gpt4 key购买 nike

我的网站中有以下 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","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"}
]
}

为什么我会收到此异常?

最佳答案

你应该包括

 jsonReader : { repeatitems: false }

在 jqGrid 参数中。

关于jquery - 尝试加载 json 时 jqGrid 给出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3213984/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com