I'm currently trying to populate the kendo grid with deleted data. Kendo has its own function for retrieving data, but I want to use the angular factory I created.
So, I have a factory that has a getSkills function. This function gets all skill objects from my api.
angular.module('MyApp').factory('Factory', function ($resource) { return $resource('/api/v1/skills/', { }, { getSkills: { method: 'GET', isArray: true } }); });
In my SkillController in angular, I put these learned skills into a scope variable.
$scope.skills = SkillFactory.getSkills();
I initialize the Kendo grid here:
$scope.gridOptions = { dataSource: { data: $scope.skills, schema: { model: { fields: { ID: { type: "number" }, Name: { type: "string" }, CreatedBy: { type: "number" }, CreatedDate: { type: "string" }, EditedBy: { type: "number" }, EditedDate: { type: "string" }, InUse: { type: "boolean" } } } }, pageSize: 20 }, scrollable: true, sortable: true, filterable: true, pageable: { input: true, numeric: false }, selectable: true, columns: [ { field: "Name", title: "skillname", width: "130px" } ] };
In most cases, the ajax callback is slower than initializing the kendo grid. Then it will show an empty table, since the table data is not bound to the variable angular $ scope.skills.
I searched everywhere, but I can't figure out how I can use a user-defined function for a data attribute in initialization, or how to bind a scope variable to a table.
Any help would be appreciated!