Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Structure of Hierarchical data
posted

Hi,

See attached image (grey is UserGroups and yellow is Users).

I have a question abt structuring hierarchical data. I have the following example:

2 tables: UserGroup and User

A User can be "Member" of multiple user group - how would this be structured so I get the result shown in figure 2 in my grid?

Nomally I would add another table between the two called something like UserGroupMemberREF that mapped the user to the UserGroups is was member of, but if I do that then I will see that table represented as a row also placed between the Group and the user.

I have another program where I do the same but are using objects and the "UserGroupMemberREF" is a collection so the Grid recognizes this and renders it like in figure 2 and skips the row between. But when I am using datatable it isn't recognizing it as a collection of course...

I need to use DataTables for this, so what could a solution be? There must be a simple solution - it a very common and simple scenario... It's the *-* reference that I'm strugling with...

Thanks, Peter Haislund

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

     Hi Peter,

    This is really more a of a SQL question than a question about the grid. I'm pretty sure there are ways to do this with SQL. Generally, what you would have to do is bring back a joined child table that includes both the child data and the mapping table data as one table. This will probably not be editable, though - I don't know if you need it to be. 

    Another alternative would be to use the UltraDataSource in On-Demand mode as your grid's Data Source. This way you coud define a data structure with only two bands and when the grid asks the data source for a set of child rows, you could use the DataSet to determine the actual child data rows and return them - thus the grid only shows two levels, but the real data source with three levels is available in the background. 

Children
No Data