This is a migrated thread and some comments may be shown as answers.

Hierarchy radgridview with more than one level

12 Answers 304 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ildefonso
Top achievements
Rank 1
Ildefonso asked on 26 Apr 2011, 08:20 AM
Hi,

I'm trying to show a radgridview into a hierarchical radgridview item.
Now i bind the treelistview with "Capitulos" Items and i have the next structure:

                 Capitulo 1
                        Capitulo 1.1
                               Capitulo 1.1.1
                 Capitulo 2
                 Capitulo 3


I need to show this one:

                    Capitulo 1
                        Capitulo 1.1
                            Product c
                            Product d
                            Product e
                                Capitulo 1.1.1
                                        Product a
                                        Product b
                    Capitulo 2
                    Capitulo 3

12 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 26 Apr 2011, 09:06 AM
Hi Axel Blasco,

You can use the approach demonstrated  in this online example . There is a source code as well.
You may see that the child grids are defined in a  HierarchyChildTemplate. This way you may nest as many levels as you wish  - you can set the child grid in the HierarchyChildTemplate the same way as the parent was set.

Best wishes,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ildefonso
Top achievements
Rank 1
answered on 26 Apr 2011, 10:03 AM

Hi, I'm trying with this code but I only get this structure:

    Capítulo 1
        Producto a
        Producto b
    Capítulo 2
        Producto c
        Producto d

I need to show this other structure:

    Capítulo 1
        Producto a
        Producto b
        
        Capítulo 1.1
            Producto e
            Producto f
    Capítulo 2
        Producto c
        producto d



<
telerik:RadGridView x:Name="RadGridView1" CanUserFreezeColumns="False"

 

 

 

 

ColumnWidth="*" ItemsSource="{Binding capítulos}"

 

 

 

GridLinesVisibility="Horizontal"

 

 

 

 

IsReadOnly="True" AutoGenerateColumns="false">

 

 

 

 

<telerik:RadGridView.ChildTableDefinitions>

 

 

 

 

<telerik:GridViewTableDefinition />

 

 

 

 

</telerik:RadGridView.ChildTableDefinitions>

 

 

 

 

<telerik:RadGridView.Columns>

 

 

 

 

<telerik:GridViewDataColumn DataMemberBinding="{Binding codc}" Header="codc" />

 

 

 

 

<telerik:GridViewDataColumn DataMemberBinding="{Binding capítulo}" Header="Capítulo" />

 

 

 

 

</telerik:RadGridView.Columns>

 

 

 

 

<telerik:RadGridView.HierarchyChildTemplate>

 

 

 

 

<DataTemplate>

 

 

 

 

<telerik:RadGridView x:Name="RadGridView1" CanUserFreezeColumns="False" AutoGenerateColumns="False" ItemsSource="{Binding productos_planificados}" ShowGroupPanel="False" IsReadOnly="True">

 

 

 

 

<telerik:RadGridView.Columns>

 

 

 

 

<telerik:GridViewDataColumn DataMemberBinding="{Binding CODP}" Header="CODP" />

 

 

 

 

<telerik:GridViewDataColumn DataMemberBinding="{Binding Producto}" DataFormatString="{}{0:c}" Header="Producto" />

 

 

 

 

</telerik:RadGridView.Columns>

 

 

 

 

</telerik:RadGridView>

 

 

 

 

</DataTemplate>

 

 

 

 

</telerik:RadGridView.HierarchyChildTemplate>

 

 

 

 

</telerik:RadGridView>

 

 

Dim

 

 

dbgesto As New GESTOSQLDataContext

 

 

 

Dim miscapis = From c In dbgesto.capítulos

 

 

 

 

 

Select c

 

 

 

 

 

Where c.CODIGOOBRA = 70

 

 

RadGridView1.ItemsSource = miscapis

0
Milan
Telerik team
answered on 27 Apr 2011, 10:31 AM

Hi Axel Blasco,

Judging from the example that has been given I believe that you are trying to achieve some kind of hybrid grouping scenario that has mixed types on every level. Could you please provide us with more information about your data structures and how the relate to each other so that we can have a better understanding of the the scenario. 



Best wishes,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ildefonso
Top achievements
Rank 1
answered on 03 May 2011, 08:11 AM
Hi,

The structure i want to show it's like this:

    Capítulo 1
        Producto a
        Producto b
        
        Capítulo 1.1
            Producto e
            Producto f
    Capítulo 2
        Producto c
        producto d


Table Capítulos (This table contains the structure of a construction project and this is the hierarchy structure)
            id                                
            Description            
            parentid

Table Productos (This table contains the products of each Capítulo)
            id
            description
            price
            idcapitulo


             
        
0
Maya
Telerik team
answered on 05 May 2011, 04:20 PM
Hello Axel Blasco,

In order to provide you with a suitable solution, I would need a bit more details on your exact requirements. How do you expect your application to be displayed ? Do you want to show only the description of those items and to visualize it like RadTreeView ? Or display it like RadTreeListView ? Or probably in a hierarchical structure by using RadGridView ?


Best wishes,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ildefonso
Top achievements
Rank 1
answered on 05 May 2011, 04:27 PM
Radtreelistview with radgrids:

Description            Produccion    Cost
Cap&iacute;tulo 1        58€         55€
        Description    Price  Quantity    Cost
        Producto a      5€    15          4€
        Producto b      8€    30          7€
        
        Cap&iacute;tulo 1.1
            Description    Price  Quantity    Cost
            Producto e      5€    15          4€
            Producto f      8€    30          7€

    Cap&iacute;tulo 2
        
Description    Price  Quantity    Cost
        Producto a      5€    15           4€
        Producto b      8€    30           7€




Thanks and sorry but i don't know how to describe it you
0
Maya
Telerik team
answered on 09 May 2011, 02:02 PM
Hi Axel Blasco,

I am sending you a sample project illustrating how you may achieve similar structure using a hierarchical RadGridView.
Let me know whether it corresponds to your particular requirements.
 

Kind regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ildefonso
Top achievements
Rank 1
answered on 09 May 2011, 02:15 PM
Hi, a lot of thanks for your sample but it has limited levels.

I need something like this sample but with unlimited child levels.

Sample:

    Club
                Players
                Sub CLub
                            Players
                            Sub Sub CLub
                                        Players
                                        .......

 A lot of thanks for your time.
0
Maya
Telerik team
answered on 09 May 2011, 02:19 PM
Hello Axel Blasco,

The exact implementation depends entirely on your custom requirements and data model. You may extend the level of hierarchy in the same way as illustrated in the sample project by defining the necessary amount of ChildTableDefinitions and HierarchyChildTemplates.
 

Greetings,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ildefonso
Top achievements
Rank 1
answered on 09 May 2011, 02:26 PM
I understand you, but i never know how many levels of childtabledefinitions i have.

I have projects with 3 levels, 20 levels , etc...

I think that the solution is to create this childtable definitions from code but i don't know how to do it.
0
Vanya Pavlova
Telerik team
answered on 09 May 2011, 02:30 PM
Hi Axel Blasco,

 

You may use the following forum thread for reference. The same is valid for Silverlight as well.


All the best,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
William
Top achievements
Rank 1
answered on 12 Dec 2011, 11:16 AM
<telerik:RadGridView.ChildTableDefinitions>
                    <telerik:GridViewTableDefinition>
                        <telerik:GridViewTableDefinition.Relation>
                            <telerik:PropertyRelation  ParentPropertyName="XXX" />
                        </telerik:GridViewTableDefinition.Relation>
                    </telerik:GridViewTableDefinition>
  </telerik:RadGridView.ChildTableDefinitions>
The XXX should be replaced with the collection property name which is also the items source for child table.
Tags
GridView
Asked by
Ildefonso
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Ildefonso
Top achievements
Rank 1
Milan
Telerik team
Maya
Telerik team
Vanya Pavlova
Telerik team
William
Top achievements
Rank 1
Share this question
or