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

Pre-populating a treeview with remote data source

3 Answers 58 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mads
Top achievements
Rank 1
Mads asked on 07 Oct 2014, 11:50 AM
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



3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 09 Oct 2014, 07:03 AM
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!
 
0
Mads
Top achievements
Rank 1
answered on 10 Oct 2014, 01:40 PM
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
0
Alexander Popov
Telerik team
answered on 14 Oct 2014, 09:33 AM
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!
 
Tags
TreeView
Asked by
Mads
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Mads
Top achievements
Rank 1
Share this question
or