您好我正在研究jqxgrid。我试图使用本地json网格加载此jqxgrid。
以下是我到目前为止所尝试的代码。但我得到一个空白的网格。
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript" src="jqwidgets/jqxscrollbar.js"></script>
<script type="text/javascript" src="jqwidgets/jqxmenu.js"></script>
<script type="text/javascript" src="jqwidgets/jqxgrid.js"></script>
<script type="text/javascript" src="jqwidgets/jqxgrid.selection.js"></script>
<script type="text/javascript" src="jqwidgets/jqxgrid.columnsresize.js"></script>
<script type="text/javascript" src="jqwidgets/jqxdata.js"></script>
<script type="text/javascript" src="scripts/gettheme.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var jsonData = [{"creation_dt":"2011-04-08 00:00:00.0","request_deliv_dt":"2011-07-01 00:00:00.0”},
{"creation_dt":"2011-04-08 00:00:00.0","request_deliv_dt":"2011-07-02 00:00:00.0"},
{"creation_dt":"2011-04-08 00:00:00.0","request_deliv_dt":"2011-07-01 00:00:00.0"},
{"creation_dt":"2011-04-08 00:00:00.0","request_deliv_dt":"2011-07-02 00:00:00.0"},
{"creation_dt":"2011-04-08 00:00:00.0","request_deliv_dt":"2011-07-01 00:00:00.0"},
{"creation_dt":"2011-04-08 00:00:00.0","request_deliv_dt":"2011-07-02 00:00:00.0"];
var jsonColumns = [{ text: 'creation_dt', datafield: 'creation_dt', width: 250 },{text:'request_deliv_dt', datafield: 'request_deliv_dt', width: 250 }];
var jsonFields = [{ name: 'creation_dt' },{ name: 'request_deliv_dt' }];
var source ={
datatype: "json",
datafields: jsonFields,
localdata: jsonData
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid(
{
width: 670,
source: dataAdapter,
columns: jsonColumns
});
});
});
</script>
</head>
<body class='default'>
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
<div id="jqxgrid"></div>
</div>
</body>
</html>
上面的代码有问题吗?? ??
任何人都可以帮我解决这个问题吗?
答案 0 :(得分:1)
您的代码中有2个错误: