-1

嗨,我正在研究 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>

上面的代码有什么问题..??

谁能帮我解决这个问题。?

4

1 回答 1

1

您的代码中有 2 个错误:

  • 最后 '});' 不应该在那里。
  • 在您的 JSON 中缺少“}”
于 2012-06-01T07:29:32.647 回答