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

Nested ColumnGroups

3 Answers 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Azamat
Top achievements
Rank 1
Azamat asked on 13 Oct 2017, 05:08 AM

Hello!

We want to design RadGridView with nested ColumnGroups, as in example. But they are rendering not as expected (see unexpected.png). As expected in expected.png. How we can get it? Thanks for support

<telerik:RadGridView>
    <telerik:RadGridView.ColumnGroups >
        <telerik:GridViewColumnGroup Name="Level1group0" >
            <telerik:GridViewColumnGroup.ChildGroups>
                <telerik:GridViewColumnGroup Name="Level1group11">
                    <telerik:GridViewColumnGroup.ChildGroups>
                        <telerik:GridViewColumnGroup Name="Level2group11"/>
                        <telerik:GridViewColumnGroup Name="Level2group12"/>
                    </telerik:GridViewColumnGroup.ChildGroups>
                </telerik:GridViewColumnGroup>
                <telerik:GridViewColumnGroup Name="Level1group12"/>
            </telerik:GridViewColumnGroup.ChildGroups>
        </telerik:GridViewColumnGroup>
 
    </telerik:RadGridView.ColumnGroups>
 
 
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn ColumnGroupName="Level1group11" Width="200" Header="Column1"/>
        <telerik:GridViewDataColumn ColumnGroupName="Level1group12" Width="200" Header="Column2"/>
        <telerik:GridViewDataColumn ColumnGroupName="Level2group11" Width="200" Header="Column3"/>
        <telerik:GridViewDataColumn ColumnGroupName="Level2group12" Width="200" Header="Column4"/>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 17 Oct 2017, 01:08 PM
Hello Azamat,

With the current implementation of the column groups functionality, vertical merging of groups is not supported.

By design, the number of header rows depends on the max depth of nested groups. The rows are then realized starting from the bottom and each column generates as many as there are parent groups for its initial group (specified by the ColumnGroupName).

In this scenario, the Level2group11 and Level2group21 groups have two parent groups, 3 rows are generated. As the Level1Group11 and Level1Group12 column groups have only one parent group, only 2 rows will be realized. The remaining rows are then filled from the bottom-up with empty groups and thus - you get the result demonstrated in unexpected.jpg.

To achieve the desired result, you can define a dummy column group to compensate the missing level.

<telerik:RadGridView.ColumnGroups >
    <telerik:GridViewColumnGroup Name="Level1group0">
        <telerik:GridViewColumnGroup.HeaderStyle>
            <Style TargetType="telerik:CommonColumnHeader">
                <Setter Property="TextBlock.TextAlignment" Value="Center"/>
            </Style>
        </telerik:GridViewColumnGroup.HeaderStyle>
        <telerik:GridViewColumnGroup.ChildGroups>
            <telerik:GridViewColumnGroup Name="Level1group11">
                <telerik:GridViewColumnGroup.ChildGroups>
                    <telerik:GridViewColumnGroup Name="Level2group11"/>
                    <telerik:GridViewColumnGroup Name="Level2group12"/>
                </telerik:GridViewColumnGroup.ChildGroups>
            </telerik:GridViewColumnGroup>
            <telerik:GridViewColumnGroup Name="Level1group12" Header="">
                <telerik:GridViewColumnGroup.ChildGroups>
                    <telerik:GridViewColumnGroup Name="Level2group21"/>
                    <telerik:GridViewColumnGroup Name="Level2group22"/>
                </telerik:GridViewColumnGroup.ChildGroups>
            </telerik:GridViewColumnGroup>
        </telerik:GridViewColumnGroup.ChildGroups>
    </telerik:GridViewColumnGroup>
</telerik:RadGridView.ColumnGroups>

I hope you find this information helpful. If any further questions or concerns arise, do not hesitate to contact us again.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Azamat
Top achievements
Rank 1
answered on 18 Oct 2017, 04:48 AM

Thanks for your answer, but it not complete solution. Yes, we need vertical merging.

0
Stefan
Telerik team
answered on 20 Oct 2017, 12:11 PM
Hi Azamat,

Thank you for the update.

As already stated by my colleague, the column groups mechanism is not designed to support vertical merging. This is the by-design implementation and I am afraid that we cannot commit ourselves to modifying it. Thus, the provided solution would be the closest one for your requirement.‚Äč

Best Regards,
Stefan
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Azamat
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Azamat
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or