This is a migrated thread and some comments may be shown as answers.

Setting children in HierarchicalDataSource to another property

3 Answers 167 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 16 Dec 2015, 09:31 AM

Hi,

 I encountered same issue as shown here: http://jsfiddle.net/ruapho/GaFd6/4/. The workaround is to define the children 'inline'.

 Btw. Is it possible to use a service or factory to fetch data from service, e.g. by injecting the service to the read function? Or I should use the $.ajax or $.get functions?

 

Best regards

Marcin Danek

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 18 Dec 2015, 04:27 PM

Hello Marcin,

 

TreeView / Binding to OData service demo illustrates how to configure different type of data sources per level and to request the data on demand, i.e expand of node.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Marcin
Top achievements
Rank 1
answered on 21 Dec 2015, 10:54 AM

Hello Nikolay,

 Thank You for Your response. I prepared this as in the example, it is working.

BUT, the problem is, when I want to use angular's service to retrieve data from service (I need this, due to using of $http interceptors mechanism to provide Bearer authentication tickets to web api methods). The problem is, that using this.myService property in the read object definition, causes the runtime error, that this property is not defined. I write the code in TypeScript. Is there any way, to pass the service to the HierarchicalDataSource definition (as asked in another thread: http://www.telerik.com/forums/custom-datasource-transport#nwoZ3-RVSkG5AnLKgnCN7w).

 

Best regards

Marcin Danek

0
Accepted
Nikolay Rusev
Telerik team
answered on 23 Dec 2015, 07:32 AM

Hello Marcin,

 

My only suggestion, without isolated runnable example of the problem, is to check what this refers to and make sure that you are accessing the right object which has `myService ` instance. This seems to be scoping issue in your code.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Marcin
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Marcin
Top achievements
Rank 1
Share this question
or