Hi,
I'm using in my new project telerik kendo controls with angularjs, furthermore I want to use TypeScript.
This combination looks really good, but now I have following problem.
I have a hierarchical datasource for a treeview. The datasource is populated with my own javascript model class.
If I try to get the selected node item, I get following typescript error:
Build: Cannot convert 'kendo.data.Node' to 'MyNamespace.Cluster'
The problem is, that .dataItem returns a node object and not my model class. If i try to cast the return value, i get this error:
Error: Cannot convert 'kendo.data.Node' to 'MyNamespace.Cluster': Type 'kendo.data.Node' is missing property 'clusters' from type 'MyNamespace.Cluster'. Type 'MyNamespace.Cluster' is missing property 'children' from type 'kendo.data.Node'
How can i get off this error?
Regards
Daniel
I'm using in my new project telerik kendo controls with angularjs, furthermore I want to use TypeScript.
This combination looks really good, but now I have following problem.
I have a hierarchical datasource for a treeview. The datasource is populated with my own javascript model class.
01.
module MyNamespace {
02.
'use strict'
;
03.
04.
export class Cluster {
05.
public clusters: Cluster[];
06.
public parentId: string;
07.
public dateCreated: Date;
08.
public dateModified: Date;
09.
10.
constructor(
11.
public id: string,
12.
public matrixId: string,
13.
public name: string,
14.
public position: number
15.
) {
16.
17.
this
.clusters = [];
18.
this
.dateCreated =
new
Date();
19.
this
.dateModified =
new
Date();
20.
}
21.
}
22.
}
If I try to get the selected node item, I get following typescript error:
Build: Cannot convert 'kendo.data.Node' to 'MyNamespace.Cluster'
The problem is, that .dataItem returns a node object and not my model class. If i try to cast the return value, i get this error:
Error: Cannot convert 'kendo.data.Node' to 'MyNamespace.Cluster': Type 'kendo.data.Node' is missing property 'clusters' from type 'MyNamespace.Cluster'. Type 'MyNamespace.Cluster' is missing property 'children' from type 'kendo.data.Node'
How can i get off this error?
Regards
Daniel