RadGrid ... Header to expand multiple columns?

3 Answers 36 Views
GridView
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Rob A. asked on 25 Jun 2021, 11:06 PM

Similar to how Excel works, I'm looking for a way to have header text span multiple columns ... see image.  Also needs to work with a "Freeze/scrolling" RadGrid.

Cheers, Rob.

 

3 Answers, 1 is accepted

Sort by
0
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 26 Jun 2021, 08:48 AM | edited on 26 Jun 2021, 08:49 AM

I found the information on Nested column groups, but unfortunately it seems to contain a bug and I can't actually get my desired results.

Nested Column Groups

Your example:


<telerik:RadGridView.ColumnGroups>           
    <telerik:GridViewColumnGroup Name="Level2group1"> 
        <telerik:GridViewColumnGroup Name="Level1group11"/> 
        <telerik:GridViewColumnGroup Name="Level1group12"/> 
    </telerik:GridViewColumnGroup> 
    <telerik:GridViewColumnGroup Name="Level2group2"> 
        <telerik:GridViewColumnGroup Name="Level1group21"/> 
        <telerik:GridViewColumnGroup Name="Level1group22"/> 
    </telerik:GridViewColumnGroup> 
</telerik:RadGridView.ColumnGroups>

will generate "duplicate column Group name error" in the designer.   This code below will work but doesn't produce the intended result:


<telerik:RadGridView.ColumnGroups>           
    <telerik:GridViewColumnGroup Name="Level2group1"> 
        <telerik:GridViewColumnGroup Name="Level1group11"/> 
        <telerik:GridViewColumnGroup Name="Level1group12"/> 
        <telerik:GridViewColumnGroup Name="Level2group2"> 
            <telerik:GridViewColumnGroup Name="Level1group21"/> 
            <telerik:GridViewColumnGroup Name="Level1group22"/> 
        </telerik:GridViewColumnGroup> 
    </telerik:GridViewColumnGroup> 
</telerik:RadGridView.ColumnGroups>

Unfortunately this makes it impossible to have correctly associated nested column groups ... it's logically impossible.  The example that doesn't work is indeed how I would logically expect the usage for Nested Column groups.  So this is most likely a bug.

Cheers, Rob.


0
Vladimir Stoyanov
Telerik team
answered on 30 Jun 2021, 04:13 PM

Hello Rob,

Thank you for the provided information. 

I tested the example from the Column Groups article in a sample project on my end, however it works as expected and I was not able to replicate the mentioned error. That is why I am attaching the project that I used for testing purposes. May I ask you to check it out and see how it differs from the setup on your end? 

Should you need any further assistance, can you modify the project in order to demonstrate your scenario and send it back? This will hopefully allow me to investigate further and better assist you. 

I am looking forward to your reply.

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 30 Jun 2021, 04:22 PM

Hi Vladimir,

In your documentation link, scroll down to Sample 6, if I copy and paste that code into my XAML I get an error (see attached image).

Cheers, Rob.

Vladimir Stoyanov
Telerik team
commented on 02 Jul 2021, 10:18 AM

I tested the same snippet in the sample project shared in my last reply, however I was not able to replicate this error. May I ask you to update the shared project in order to demonstrate your scenario and send it back? This will hopefully allow me to investigate further and better assist you. 

Tags
GridView
Asked by
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Vladimir Stoyanov
Telerik team
Share this question
or