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())
I just start to learn how to code tiny fishing. Very complicate
smith marry said:Everyone has their own choices. But this solution really great. I like these types of concepts in Creator outfits.
I agree with you. I always use these types of logics in my code. Recently i write a code for bad bunny sweatshirts.
I agree with you. In the terms of
- Sub-sub-sub node for Bad Bunny Shirts.
Everyone has their own choices. But this solution really great. I like these types of concepts in Creator outfits.
Vielen Dank für diesen Beitrag. Thanks for sharing such a beautiful knowlege for lil peep store dataset.