0

我想以声明的方式实现一个非常简单的 Dojo DataGrid。我有这个

<script>
require(['dojox/grid/DataGrid', 'dojo/data/ItemFileReadStore', 'dojo/query'],
  function(DataGrid, ItemFileReadStore){


    var layout = [
        {name: 'Index', field: 'id', 'width': '100px'},
        {name: 'Date', field: 'date', 'width': '300px'},
        {name: 'Name', field: 'name', 'width': '600px'}
    ];

    var myStore = new ItemFileReadStore({
        data: {
            identifier: "id",
            items: [
                {id: 1, date: '2010-01-01', name: 'dadasd dsadasdas dasdasdasd asdasdadas asd dasdasdas'},
                {id: 2, date: '2011-03-04', name: 'dadasd dsadasdas dasdasdasd asdasdadas asd dasdasdas'},
                {id: 3, date: '2011-03-08', name: 'dadasd dsadasdas dasdasdasd asdasdadas asd dasdasdas'},
                {id: 4, date: '2007-02-14', name: 'dadasd dsadasdas dasdasdasd asdasdadas asd dasdasdas'}
            ]
        }
    });

});
    </script>
</head>
<body class="claro">
    <div style="width:1024px;margin:auto">       
        <table id="myGrid" data-dojo-typ="dojox.grid.DataGrid" data-dojo-props="store:myStore,  query:{ id: '*' },  clientSort:true, rowSelector:'20px'">
            <thead>
                <tr>
                    <th field="id" width="50px">Id</th>
                    <th field="date" width="100px">Date</th>
                    <th field="name" width="400px">Name</th>
                </tr>        
            </thead>
        </table>    
    </div>
</body>

但是什么都没有显示(只有表头列......而且我在控制台中没有 js 错误)有人可以帮我解决这个问题吗?谢谢

4

0 回答 0