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

Non self-referencing On Demand Sample

2 Answers 29 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jesse
Top achievements
Rank 1
Jesse asked on 25 Sep 2015, 06:31 PM
I am looking for an example that loads a treeview from data that is not self-referencing (no ParentID field) but with specific category levels.  If my data looks like:
ID   Lastname     Firstname  City       State
1     Davolio         Nancy          Seattle   WA
2     Fuller            Andrew        Tacoma  WA
3     Washington George          Dallas     TX
4     Leverling      Janet            Kirkland  WA
5     Peacock       Margaret      Seattle    WA
6     Doe              Jane             Austin     TX
7     Doe              John             Dallas     TX

… I want it to come out like this:
TX
 └ Austin
          └ Jane Doe
└ Dallas
          └ George Washington
          └ John Doe
WA
  └ Kirkland
            └ Janet Leverling
  └ Seattle
            └ Nancy Davolio
            └ Margaret Peacock
   └ Tacoma
            └ Andrew Fuller


I also would like it to load on demand (JsonResult) as each state and city gets expanded.
Is there an example on how to build the tree like this?

2 Answers, 1 is accepted

Sort by
0
Jesse
Top achievements
Rank 1
answered on 27 Sep 2015, 11:30 AM
I figured out how to load the tree using the TreeViewItemModel in the controller and binding to it in the view, but it loads all nodes at once.  Any clues on how to make each level load on demand?
0
Boyan Dimitrov
Telerik team
answered on 29 Sep 2015, 01:23 PM

Hello Jesse,

 

The loadOnDemand option indicates whether the child DataSources should be fetched lazily when parent groups get expanded. 

 

When the kendo UI TreeView is bound to remote data source this option is set to true, so the child items are loaded when the parent node is expanded. 

 

Regards,
Boyan Dimitrov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
Jesse
Top achievements
Rank 1
Answers by
Jesse
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or