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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

126709 Oct 17,2016 09:28 AM Oct 18,2016 08:20 AM ASP.NET MVC 1
loading
Tags: TreeGrid
Morny
Asked On October 17, 2016 09:28 AM

Hi

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:

1.
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?

2.
And if so, how?

Regards

Morten

Jonesherine Stephen [Syncfusion]
Replied On October 18, 2016 08:20 AM

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,  
<GRID>  
//Here we bound the hierarchical grid with different model classes  
@(Html.EJ().Grid<HierachyGrid.Controllers.EmployeeView>("HierarchyGrid")   
        .Datasource((IEnumerable<object>)ViewBag.datasource)   
        .Columns(col =>  
        {  
. . .  
        })  
                 .ChildGrid<HierachyGrid.Controllers.Orders>(child =>  
                 {  
                     child.Datasource((IEnumerable<object>)ViewBag.childDataSource1)  
                        .QueryString("EmployeeID")  
                        .AllowPaging()  
                        .Columns(col =>  
                        {  
                            . . .  
                        })  
                        .ChildGrid<HierachyGrid.Controllers.Customer>(d =>  
                        {  
                            d.Datasource((IEnumerable<object>)ViewBag.child2DataSource2)  
                           .QueryString("CustomerID")  
                           .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”.  
Regards,  
Jone sherine P S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;