在尝试将数据从 sqldatabase 加载到 jqgrid 时,在调试代码时弹出错误提示
“Microsoft JScript 运行时错误:对象不支持属性或方法‘jqGrid’并且不将数据加载到 jqgrid。
<html>
<head>
<title></title>
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="../../Content/jquery.jqGrid/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-2.0.2.min.js" type="text/javascript"></script>
<script src="../../Scripts/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="../../Scripts/knockout-2.2.1.js" type="text/javascript"></script>
<script src="../../Scripts/knockout.mapping-latest.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#t1").jqGrid({
url: '/Home/getorders',
datatype: 'json',
mtype:'GET',
height: 150,
rowNum: 10,
rowList: [10, 20, 30],
colNames: ['id', 'invoicedate', 'name', 'note', 'tax', 'total'],
colModel: [{ name: 'id', index: 'id' },
{ name: 'invoicedate', index: 'invoicedate' },
{ name: 'name', index: 'name' },
{ name: 'note', index: 'note' },
{ name: 'tax', index: 'tax' },
{ name: 'total', index: 'total'}],
viewrecords: true,
pager: "#d1",
caption: "Table Data"
});
var ids = jQuery("#t1").jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++)
jQuery("#t1").jqGrid('addRowData',ids[i]);
// does not load data into table "#t1".//
});
</script>
</head>
<body>
<table id="t1">
</table>
<div id="d1">
</div>
</body>
</html>