简体   繁体   English

数据源未绑定到Kendo网格

[英]datasource not binding to kendo grid

I am not able to get the kendo-grid on my html screen. 我无法在html屏幕上获取剑道网格。 It does not shows any error but does not shows the outut as well. 它不显示任何错误,但也不显示输出。

 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body ng-app="KendoDemos"> <h1>Customer list</h1> <div ng-controller="CustomerController"> <!--<kendo-grid options="mainGridOptions"> </kendo-grid>--> <div ng-controller="CustomerController" id="myKendoDemos" kendo-grid k-data-source="gridData" k-columns="gridColumns"></div> </div> <link href="Content/kendo/2014.2.716/kendo.common.min.css" rel="stylesheet" /> <link href="Content/kendo/2014.2.716/kendo.default.min.css" rel="stylesheet" /> <link href="Content/bootstrap.min.css" rel="stylesheet" /> <script src="Scripts/jquery-1.10.2.min.js"></script> <script src="Scripts/angular.min.js"></script> <script src="http://cdn.kendostatic.com/2014.3.1119/js/kendo.all.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-route.min.js"></script> <!--<script src="Scripts/kendo/2014.2.716/kendo.grid.min.js"></script> <script src="Scripts/kendo/2014.2.716/kendo.core.min.js"></script>--> <script> var app = angular.module("KendoDemos", ["ngRoute"]); app.controller("CustomerController", function ($scope) { $scope.gridData = [ { customerId: 1, customerName: 'shikhar1' }, { customerId: 2, customerName: 'shikhar2' }, { customerId: 3, customerName: 'shikhar3' }, { customerId: 4, customerName: 'shikhar4' } //{ //dataSource: "http://localhost:58816/api/Values" // } ]; $scope.gridColumns = [{ field: "customerId", title: "customerId", width: "120px" }, { field: "customerName", title: "customerName", width: "120px" }]; }); </script> </body> </html> 

First of all since you are using kendo-grid , k-data-source and k-columns which are directives, you need to add kendo.directives as an app dependency 首先,由于您使用的是kendo-gridk-data-sourcek-columns指令,因此需要将kendo.directives添加为应用程序依赖项

var app = angular.module("KendoDemos", ["ngRoute", "kendo.directives"]);

Here's a Working Plunk of a Kendo Grid using your options. 这是使用您的选项的剑道网格的工作插件 Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM