0

我正在使用剑道 UI 库。

试图将数据绑定到网格。但是网格没有填充数据。

我也提到了所需的 js 库和样式。

<head>
    Referred necessary Styles and Scripts are in order
    <script src="scripts/jquery.min.js" type="text/javascript"></script>
    <script src="scripts/kendo.web.min.js" type="text/javascript"></script>
</head>
<body>
<div id="courses"></div>
<script type="text/javascript">
    $(document).ready(function () {
        var Courses = [
            {Name: "Theory of computation", Credit: 10},
            {Name: "Probability and Statistics", Credit: 20},
            {Name: "Discrete Maths", Credit: 10},
            {Name: "Modern Physics", Credit: 25},
            {Name: "Management Information System", Credit: 15 },
            {Name: "Game Theory", Credit: 5 }
        ];

        var courseDataSource = new kendo.data.DataSource({datasource: Courses, PageSize: 5});
        courseDataSource.read();
        $("#courses").kendoGrid({
            dataSource: courseDataSource,
            columns   : [
                { field: "Name", title: "Course Name"} ,
                { field: "Credit", title: "Credits" }
            ],
            scrollable: false,
            pageable  : true
        });
    });
</script>
</body>

你能帮我修复代码吗?

4

1 回答 1

1

请将数据源更改为数据,将PageSize更改为pageSize

 var courseDataSource = 
new kendo.data.DataSource({datasource: Courses, PageSize: 5});

正确的实现是

var courseDataSource = 
    new kendo.data.DataSource({data: Courses, pageSize: 5});

谢谢。

于 2013-06-17T02:50:32.933 回答