How do you code the Infragistics tree for unlimited levels of hierarchy? I.e. sub-nodes under sub-nodes under sub-nodes, etc.
Desired result:
Main node 1
- Sub node 1
- Sub node 2
- Sub-sub node 1
- Sub-sub-sub node
- Sub node 3, etc.
Here is my model class. Notice the "ChildItems" list inside it.
public class TreeListItem : ICloneable, IComparable, IComparable<TreeListItem> { public string Text { get; set; } public object Value { get; set; } public string Base64ImageUrl { get; set; } = ""; public List<TreeListItem> ChildItems = new List<TreeListItem>();}
Here is my MVC view code, which only shows the first level without any child items.
@(Html.Infragistics().Tree() .ID("FilterTree") .Bindings(b1 => { b1 .ValueKey("Value") .TextKey("Text") .ImageUrlKey("Base64ImageUrl") .ChildDataProperty("ChildItems"); }) .DataSource(Model.TreeListItems) .DataBind() .Render())
This also did not show any child items:
@(Html.Infragistics().Tree() .ID("FilterTree") .Bindings(b1 => { b1 .ValueKey("Value") .TextKey("Text") .ImageUrlKey("Base64ImageUrl") .ChildDataProperty("ChildItems") .Bindings(b2 => b2 .ValueKey("Value") .TextKey("Text") .ImageUrlKey("Base64ImageUrl") .ChildDataProperty("ChildItems") ); }) .DataSource(Model.TreeListItems) .DataBind() .Render())
Totally incredible posting! Loads of valuable data and motivation, Author shared such a wonderful article with us. Thanks for posting.
I completely agree with you. It's a very fantastic and straightforward solution. I usually favour folks that can supply me with a suitable answer without any hassles.
Yeah its really helpful for wilbur soot multiple sub-nodes within sub-nodes.
Thank you for including solution sub-nodes within sub-nodes within sub-nodes. This solution was quite beneficial to me in the Karl Jacobs Bags hierarchy.
Thanks for sharing such a great solution. It's really helpful for my university task ranboo plush toy control.