Jqgrid能够加载数据。但是,当它被加载时,会出现错误。
错误位于lin jqgrid版本下面:
k=b.jgrid.formatter.integer||{}
saying unable to get property of undefined null reference
布局包括脚本文件如下:
<script src='@Url.Content("~/Scripts/jqgrid/jquery-1.10.2.min.js")' type="text/javascript"></script>
<script src='@Url.Content("~/Scripts/jqgrid/i18n/grid.locale-en.js")' type="text/javascript"></script>
<script src='@Url.Content("~/Scripts/jqgrid/jquery.jqGrid.min.js")' type="text/javascript"></script>
请帮帮我我只是卡住了。花了3个小时..。
我在谷歌上找到了很多链接,在这里,它没有添加或添加到第一行。但还是没有成功。
$('#CategoriesGrdList').jqGrid({
ajaxGridOptions: {
error: function () {
$('#CategoriesGrdList')[0].grid.hDiv.loading = false;
alert('An error has occurred.');
}
},
url: '@Url.Action("GetAllCategoriesList", "Categories")/' + 0,
gridview: true,
autoencode: true,
//public JsonResult GetEnrolls(int adClassSchedID,DateTime attendanceDate,int adProgramID,int syCampusID)
postData: { categoryId: 1 },
//postData: { categoryId: rowID, attendanceDate: $('#AttendanceDate').val(), adProgramID: $('#adProgramID').val(), syCampusID: $('#syCampusID').val() },
datatype: 'json',
jsonReader: { root: 'List', page: 'Page', total: 'TotalPages', records: 'TotalCount', repeatitems: false, id: 'Id' },
mtype: 'GET',
colNames: ['Id', 'Code', 'Description', 'IsActive'],
colModel: [
{ name: 'Id', index: 'Id', hidden: true },
{ name: 'Code', index: 'Code', width: 170 },
{ name: 'Description', index: 'Description', width: 170 },
{ name: 'IsActive', index: 'IsActive', width: 170 }
],
pager: $('#CategoriesGrdPager'),
sortname: 'Code',
rowNum: 40,
rowList: [3, 3, 3],
width: '525',
height: '100%',
viewrecords: true,
beforeSelectRow: function (rowid, e) {
return false;
},
sortorder: 'desc'
}).navGrid('#CategoriesGrdPager', { edit: false, add: false, del: false, search: false, refresh: false });
});
谢谢
发布于 2014-09-13 03:00:03
首先,在发生jquery.jqGrid.src.js
内部的错误时,您应该始终使用jquery.jqGrid.min.js
而不是jquery.jqGrid.min.js
。
我假设错误的原因是i18n
文件夹中缺少了i18n
或其他特定于语言的文件。语言文件应该包含在之前,、jquery.jqGrid.min.js
或jquery.jqGrid.src.js
。您应该验证是否真的加载了grid.locale-en.js
。未定义的$.jgrid.formatter
可能意味着只缺少grid.locale-en.js
(参见这里)。
我建议您将您的HTML文件(特别是<head>
部件)与jqGrid文档中的演示HTML文件进行比较。
https://stackoverflow.com/questions/25822471
复制相似问题