javascript jsGrid没有加载

时间:2018-05-23 20:33:11

标签: javascript html jsgrid

我在网上点了这个简单示例的来源:http://js-grid.com/demos/basic.html

我通过为jsGrid添加完整的cdn路径来调整它。为简洁起见,我删除了除两个网格列以外的所有内容...从springboot应用程序启动页面...表格标题显示但不是示例json数据。

这就是我最终的工作......

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Basic Scenario - jsGrid Demo</title>

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300,600,400' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="/css/demos.css" />
    <link rel="stylesheet" type="text/css" href="/css/jsgrid.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/jsgrid-theme.min.css" />

    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/cupertino/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>

    <script>window.jQuery || document.write('<script src="/js/jquery-1.8.3.js"><\/script>')</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.2/jsgrid.css"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.2/jsgrid.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.2/jsgrid.min.css"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.2/jsgrid.min.js"></script>
</head>
<body>
<h1>Basic Scenario</h1>

<div id="jsGrid"></div>

<script>


    $("#jsGrid").jsGrid({
        height: "90%",
        width: "100%",

        filtering: true,
        editing: true,
        sorting: true,
        paging: true,
        autoload: true,

        pageSize: 15,
        pageButtonCount: 5,

        deleteConfirm: "Do you really want to delete the client?",

        controller: {
                loadData: function(filter) {
                return {
                          data: [{"Name":"Edmund","Age": "25"},
                                 {"Name":"Edmund","Age": "25"}
                                ],
                          itemsCount: 2
                      };
                }
            },

        fields: [
            { name: "Name", type: "text", width: 150 },
            { name: "Age", type: "text", width: 50 }
        ]
    });


</script>

</body>
</html>

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

如果将controller.loadData设置为pageLoading,则true中返回的数据结构有效。否则你可以简单地使用:

controller: {
        loadData: function(filter) {
            return [
                { Name: 'Edmund', Age: '25' },
                { Name: 'Edmund', Age: '25' },
            ];
        },
    },

来源:http://js-grid.com/docs/#controller