Setting children in HierarchicalDataSource to another property

4 posts, 1 answers
  1. Marcin
    Marcin avatar
    31 posts
    Member since:
    Jul 2013

    Posted 16 Dec 2015 Link to this post

    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

  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 18 Dec 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Marcin
    Marcin avatar
    31 posts
    Member since:
    Jul 2013

    Posted 21 Dec 2015 in reply to Nikolay Rusev Link to this post

    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

  5. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 23 Dec 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready