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

Autogenerating header groups in RadGridView?

2 Answers 51 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 15 Jul 2020, 07:18 PM

Hello.  I have a RadGridView with a large collection of items (4000 columns, up to 400 rows), which are grouped together (4 columns in each group).  Currently, we're generating the columns and groups in the codebehind, but it takes a long time to generate the table since we're creating every column and group object, even if they're not currently shown.

We end up with a table that looks similar to the (completely fake) attached image - 4 columns of statistics for each item in the header.

 

I'd like to try autogenerating the columns and groups, using virtualization so we don't have to create the view objects for every column and group unless they're needed.  However, I don't know how to autogenerate the groups.  Is there a way to do so in the xaml?  Or, is the solution to autogenerate the columns, but add the groups programatically as the columns are generated?

I haven't attached any dummy data, since I expect the data has to be organized in a specific manner to get this to work.

 

Thanks in advance for any help you can provide.

2 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 15 Jul 2020, 07:22 PM
Here's a link to the image which didn't get attached:

https://imgur.com/a/yD8AWxG

0
Vladimir Stoyanov
Telerik team
answered on 20 Jul 2020, 12:36 PM

Hello Ed,

Thank you for the attached image. 

I am assuming that you are using the ColumnGroups feature of the RadGridView. Feel free to correct me, if I am wrong and elaborate on the scenario. 

If that is indeed the case, you can specify the column groups in xaml or in code. Then you can use the AutoGeneratingColumn event in order to set the ColumnGroupName property of the auto generated columns.

On a side note, the UI Virtualization mechanism refers to the creation of only the visible UI elements. If the virtualization is enabled, the RadGridView will create only the visible cells and rows irrespective of the number of columns that are defined. 

I hope you find this information helpful. Let me know, if I can be of any further assistance. 

Regards,
Vladimir Stoyanov
Progress Telerik

Tags
GridView
Asked by
Ed
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or