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

Multiple roots

1 Answer 199 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 24 Jan 2019, 12:50 AM

So lets say I have a set of entities

          ObjectModel1 - Id, Name, List<ObjectModel2> Children

          ObjectModel2 - Id, Name, Note, DateModified, ModifiedBy

So now my dataset might return

          ObjectModel1 om1a

                    ObjectModel2 om2a

                    ObjectModel2 om2b

          ObjectModel1 om1b
                    ObjectModel2 om2c
                    ObjectModel2 om2d

This would come down as a List<ObjectModel1> object with the ObjectModel1 objects in the list having the ObjectModel2 objects as children.

I would like to display this so that each of the ObjectModel1 objects are displayed as separate trees with all of the data from each ObjectModel2 object being displayed when the ObjectModel1 trees are expanded.

So, first of all, is this possible with the Kendo treeview, and if not, what would we use?  Second, even if it is possible, is there a better UI component to do the above?   

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 25 Jan 2019, 02:43 PM
Hello Brian,

See the following demo, which shows a TreeView bound to data in a scenario similar to the one you describe (different models are used for root and child nodes). You can review the view and the controller logic in the demo's ASP.NET MVC source section.

You can also check the demos of the TreeList, which combines the capabilities of the TreeView in displaying hierarchical data and some of the capabilities of the Grid (columns, editing, filtering, paging, etc.).

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TreeView
Asked by
Brian
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or