Pre-populating a treeview with remote data source

4 posts, 0 answers
  1. Mads
    Mads avatar
    2 posts
    Member since:
    Apr 2014

    Posted 07 Oct 2014 Link to this post

    Hello,

    I would like to build a tree partially when the page is rendered and then tie it to a data source so that any subsequent node expansions will fetch data from a remote data source. What I am trying to accomplish is to restore the state the tree next time the user accesses the site.

    Is this currently possible? Any examples you could provide would be very helpful.

    Thanks and regards,
    Mads



  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 09 Oct 2014 Link to this post

    Hello Mads,

    You can achieve similar behavior using a slightly different approach, requiring less custom code. For example, you could store the path the expanded nodes and use the TreeView's expandPath method once the page loads.

    Regards,
    Alexander Popov
    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. Mads
    Mads avatar
    2 posts
    Member since:
    Apr 2014

    Posted 10 Oct 2014 in reply to Alexander Popov Link to this post

    Hi Alexander,

    Thanks for your reply.

    By using expandPath I would be hitting the database each time a level is expanded. The tree is very large so I don't think this is feasible. 

    I would like to load the initial state of my tree into a json object and have the treeview render it. And then subsequently whenever a user expands a node the tree should fetch the next level via ajax call (standard remote data source).

    Any pointers you can give me would be a huge help

    Regards,
    Mads
  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 14 Oct 2014 Link to this post

    Hello Mads,

    I am afraid that this kind of binding is currently not supported out of the box. You could achieve similar behavior by generating a local DataSource on the server-side, using it during the TreeView's initialization then replacing it with a remote one when necessary. Implementing this however, would require a custom solution that is beyond the scope of our support services.

    Regards,
    Alexander Popov
    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