ksd07
April 15, 2018, 6:08pm
1
I need to create Kendo Grid dynamically and bind to JSON data source. Because we are not sure of column names.So there will no column names for the Grid. I am using angular 1.5. The json data will something like this .Any sample code would be appreciate. Thank you
[
{"data":"1,Lee,19,17,false,1996-07-04T21:00:00.000Z"},
{"data":"2,Tom,19,17,false,1996-07-04T21:00:00.000Z"},
{"data":"3,Roy,19,17,false,1996-07-04T21:00:00.000Z"}
]
ksd07:
[
{“data”:“1,Lee,19,17,false,1996-07-04T21:00:00.000Z”},
{“data”:“2,Tom,19,17,false,1996-07-04T21:00:00.000Z”},
{“data”:“3,Roy,19,17,false,1996-07-04T21:00:00.000Z”}
]
Check this code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.mobile.all.min.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.all.min.js"></script></head>
<body>
<div ng-app="app" ng-controller="MyCtrl">
<div kendo-list-view k-data-source="source">
<!-- the template (including the div tag itself) here will be assigned as a string to the `template` configuration option of the listview widget -->
<div class="product" k-template>
<p>{{ dataItem.data }}</p>
</div>
</div>
</div>
<script>
angular.module("app", ["kendo.directives"]).controller("MyCtrl", function($scope) {
$scope.source = new kendo.data.DataSource({
data:[
{"data":"1,Lee,19,17,false,1996-07-04T21:00:00.000Z"},
{"data":"2,Tom,19,17,false,1996-07-04T21:00:00.000Z"},
{"data":"3,Roy,19,17,false,1996-07-04T21:00:00.000Z"}
],
pageSize: 21
});
});
</script>
</body>
</html>
ksd07
April 17, 2018, 1:18am
3
@liontas76 Thank you so much
system
Closed
July 17, 2018, 8:18am
4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.