0

我似乎无法在下面的剑道网格中获取本地数据(var people)。如果没有 people 数组和 dataSource 属性,列数据可以很好地呈现。所以不确定错误在哪里。

<!doctype html>
<head>
<link href="styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/kendo.web.min.js" type="text/javascript"></script>

</head>
<body>
<div id="grid">
</div>
<script>
$(function(){
    $("#grid").kendoGrid({

        var people = [{patientName: "John Doe", MRN: "464684778", account: "56765765224768", dateOfBirth: "01/06/2013", room: 403, bed: 22, admitDate: "01/15/2013" }];

                columns: [{title: "Patient Name"},
                    {title: "MRN"},
                    {title: "Account#"},
                    {title: "Date of Birth"}, 
                    {title: "Room"}, 
                    {title: "Bed"}, 
                    {title: "Admit Date"}],

                    dataSource: {
            data:people
        }                   
    });
});
</script>
</body>
</html>
4

1 回答 1

2

有几件事我看到...

  1. people 数组在网格初始化代码中
  2. 您没有在列中指定字段。

    $(function(){
    
       var people = [{patientName: "John Doe", MRN: "464684778", account: "56765765224768", dateOfBirth: "01/06/2013", room: 403, bed: 22, admitDate: "01/15/2013" }];
    
    
       $("#grid").kendoGrid({
         columns: [{field: "patientName", title: "Patient Name"},
                   {field: "MRN", title: "MRN"},
                   {field: "account", title: "Account#"},
                   {field: "dateOfBirth", title: "Date of Birth"}, 
                   {field: "room", title: "Room"},
                   {field: "bed", title: "Bed"},
                   {field: "admitDate", title: "Admit Date" }],
         dataSource: {
           data:people
         }                   
      });
    
    });
    

工作样本:http: //jsbin.com/uxaqus/1

于 2013-02-05T22:45:47.113 回答