We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to display a hierarchical structure with different classes on each level


I have a need for displaying, and to some extend performing CRUD operations on a data structure similar to: Customer – Sales Invoices – Sales Invoice Lines – Sale Invoice Line Details or Teacher – Class – Students - Grades.

The need for CRUD operations are not present on all levels, but let’s say on the Sales Invoice and Sale Invoice Line Details levels.

I would like to show data in a hierarchical structure with each level indented under the upper level. This is possible to do in a tree grid, but I’m unsure if the tree grid can handle different types of classes or if all levels must bee of the same class. I’m unable to find anything useful information about this.

A data grid can achieve the structure by grouping of data, but I don’t like this approach as the hierarchy is static, and a grouping can be altered by the user. This would mess up the easy overview I’m trying to achieve.

My questions are:

Is it possible to achieve my display needs with a hierarchical structure of different classes in the same grid e.g. a tree grid, data grid or some other control I haven’t mentioned?

And if so, how?



1 Reply

JS Jonesherine Stephen Syncfusion Team October 18, 2016 12:20 PM UTC

Hi Morten, 
Thanks for contacting Syncfusion support. 
We can achieve this requirement by using Grid. As you have mentioned different class to bind the Hierarchical structure grid. From this, we have a Hierarchical grid feature to bound the Grid with different children with different data source. Please refer to the below code example,  
//Here we bound the hierarchical grid with different model classes  
        .Columns(col =>  
. . .  
                 .ChildGrid<HierachyGrid.Controllers.Orders>(child =>  
                        .Columns(col =>  
                            . . .  
                        .ChildGrid<HierachyGrid.Controllers.Customer>(d =>  
                           .Columns(col =>  
Please refer to the Help documentation and online Demo for more information,  
If we misunderstood your query, then could you please share more details about your requirement and also please provide more information about the query “different types of classes or if all levels must be of the same class”.  
Jone sherine P S 

Live Chat Icon For mobile
Up arrow icon