这是 jqgrid 版本 4.4.1 和 IE9/10 在 MVC 4 Web 应用程序中的一个奇怪的挂起问题(MVC 3 也发生过)。
我有很多带有 jqgrids 的页面,这是所有页面的问题。当在开发模式下运行时(按 F5 键),页面在 IE 中工作正常,但是当它们从 Web 服务器运行时,它会挂起浏览器。这在 Chrome、Safari 或 Firefox 中不是问题。
如果我打开IE JS错误显示,不断出现如下错误,这就是浏览器死机的原因:
消息:无效的参数。行:151 字符:212 代码:0 URI:.../Scripts/jquery.jqGrid-4.4.1.min.js
这是来自其中一个悬挂页面的 jgrid:
$("#GridQuery").jqGrid({
caption: "Lists",
colNames: [
"ID",
"Select",
"List Name",
"Last Import Date",
"Last Run Date"
],
colModel: [
{ name: "ID", index: "ID",
hidden: true,
sortable: false,
width: 0
},
{ name: "Select", index: "Select",
align: "center",
sortable: false,
width: 10
},
{ name: "ListName", index: "ListName",
sortable: false,
width: 60
},
{ name: "LastImportDate", index: "LastImportDate",
align: "center",
sortable: false,
width: 30
},
{ name: "LastRunDate", index: "LastRunDate",
align: "center",
sortable: false,
width: 30
}
],
altRows: true,
altclass: "altGridRows",
cellEdit: false,
cellsubmit: "clientArray",
datatype: "json",
emptyrecords: "No lists have been defined",
footerrow: false,
gridview: true,
height: "100%",
mtype: "post",
pager: "#GridQueryPager",
rowList: [5, 10, 20],
rowNum: 5,
url: "/App/GetQueryList",
userDataOnFooter: false,
viewrecords: true,
width: 700,
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: true,
cell: "cell",
id: "id",
userdata: "userdata"
},
gridComplete: function () {
var idList = $("#GridQuery").jqGrid("getDataIDs");
if (idList) {
for (var iX = 0; iX < idList.length; iX++) {
var id = $("#GridQuery").jqGrid("getCell", idList[iX], "ID");
var checkbox = "<input type='checkbox' id='Check_" + iX + "' />";
$("#GridQuery").jqGrid("setCell", idList[iX], "Select", checkbox);
}
}
}
});