angularjs kendo datasource data length zero -
i'm trying grid (created angular directive) populated data, not populating.
here's grid declaration:
<div id="daytypesgrid" kendo-grid k-options='daytypesgridoptions'></div>
here's code angular controller:
$scope.daytypesgridoptions = { schema: { model: { id: "description", fields: { description: { editable: false, nullable: false }, numberofdays: { type: "number", validation: { required: true, min: 0} } } } }, columns: [{ field: "description", title: "day type" }, { field: "numberofdays", title: "number of days" }] };
so far good. grid instantiated, , see 2 columns. , angular controller executes data fetch call, , store result in array $scope.viewmodel.daytypes. using browser dev tools, can see $scope.viewmodel.daytypes indeed contains array of 7 records. want display 7 records in grid, , follows:
var ds = new kendo.data.datasource({data: $scope.viewmodel.daytypes}); $('#daytypesgrid').data('kendogrid').datasource = ds;
after last line of code grid still remains empty. using browser dev tools, see ds.data.length zero.
what missing?
what you're looking setdatasource method:
$('#daytypesgrid').data('kendogrid').setdatasource(ds);
Comments
Post a Comment