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

Group Header - row data in group header

11 Answers 609 Views
GridView
This is a migrated thread and some comments may be shown as answers.
schneeflocke
Top achievements
Rank 1
schneeflocke asked on 20 May 2010, 07:17 PM
Hi, I tried all the samples found in the forum but I didn't come to a final solution.

I want to group a grid by a special column. Additionaly I want to add to the group header different data like a description text, the content of the description text comes from the data grid source.

A picture describes more than 100. words, so I attached an image which should better explain how the data source looks like and how the result should look like.

The bigges problem ist to generate the second header group with different content as the first header group.

Thanks

Stefan

11 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 May 2010, 06:50 AM
Hello Stefan,

You can use GroupHeaderTemplate column property to define desired UI when the grid is grouped by this column. Please check this demo for more info.

Regards,
Vlad
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
schneeflocke
Top achievements
Rank 1
answered on 22 May 2010, 05:01 PM
Hi,

the demo really helps. I'm a few steps further, but I struggle in the following situation.
Attached you can find a picture which describes the problem. I defined individual group templates for two different columns. Both group header definitions contain a list box the content picked up out of the grid content (items). If you execute the first grouping of the grid the group header with the list box content appears correct. If you then group a second time by an other grid field, the content of the first group header disapears.

The grid is defined in the following way:
        <telerikGridView:RadGridView x:Name="myGrid" Margin="0"  AutoGenerateColumns="False" IsReadOnly="True" CanUserFreezeColumns="False" AutoExpandGroups="True" CanUserDeleteRows="False" CanUserInsertRows="False" ShowGroupPanel="True">  
                    <telerikGridView:RadGridView.Columns> 
                        <telerikGridView:GridViewDataColumn Header="Week hdr" DataMemberBinding="{Binding Week}" IsVisible = "True">  
                            <telerikGridView:GridViewDataColumn.GroupHeaderTemplate> 
                                <DataTemplate> 
                                <StackPanel Orientation="Vertical" Margin="5,0">  
                                    <TextBlock Foreground="Green" Text="{Binding Group.Key}" /> 
                                    <ListBox ItemsSource="{Binding Group.Items}" DisplayMemberPath="WeekNo" Height="20" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="{x:Null}" IsEnabled="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"/>  
                                </StackPanel> 
                                </DataTemplate> 
                            </telerikGridView:GridViewDataColumn.GroupHeaderTemplate> 
                        </telerikGridView:GridViewDataColumn> 
                          
                        <telerikGridView:GridViewDataColumn Header="Week No" DataMemberBinding="{Binding WeekNo}" IsVisible = "True">  
                            <telerikGridView:GridViewDataColumn.GroupHeaderTemplate> 
                                <DataTemplate> 
                                <StackPanel Orientation="Vertical" Margin="5,0">  
                                    <TextBlock Foreground="Green" Text="{Binding Group.Key}" /> 
                                    <ListBox ItemsSource="{Binding Group.Items}" DisplayMemberPath="Day" Height="20" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="{x:Null}" IsEnabled="False" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"/>  
                                </StackPanel> 
                                </DataTemplate> 
                            </telerikGridView:GridViewDataColumn.GroupHeaderTemplate> 
                        </telerikGridView:GridViewDataColumn> 
                        <telerikGridView:GridViewDataColumn Header="Day" DataMemberBinding="{Binding Day}" IsVisible = "True"/>  
                    </telerikGridView:RadGridView.Columns> 
        </telerikGridView:RadGridView> 
0
Vlad
Telerik team
answered on 27 May 2010, 07:41 AM
Hello,

When you have more than one group Group.Items will return sub groups not data items and that is why in your case the data from the ListBox will disappear.

Best wishes,
Vlad
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
schneeflocke
Top achievements
Rank 1
answered on 27 May 2010, 07:46 AM
Hi,

thanks for the replay. Do you have any idea how I can solve this? How can I keep the values of the first group header description? Any chance to get this working using the telerik grid?

Best Regards

Stefan
0
Vlad
Telerik team
answered on 27 May 2010, 08:04 AM
Hello Stefan,

The list box is working correctly however as I said you will get enumerable with IGroup when you have nested grouping and these items does not have WeekNo property.

All the best,
Vlad
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
schneeflocke
Top achievements
Rank 1
answered on 28 May 2010, 11:56 AM
Hi,

any idea how I can solve this in an other way? I really stuck at this point.

Thanks

Stefan
0
Vlad
Telerik team
answered on 31 May 2010, 07:10 AM
Hello,

Can you post more info about what exactly you want to show? For single group you have group items - do you want to show all data items from all subgroups in case of nested groups?

Please post more info about your scenario and desired result!

Sincerely yours,
Vlad
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
schneeflocke
Top achievements
Rank 1
answered on 01 Jun 2010, 09:14 PM
Hi,

you can see it in the picture that I previously attached to the reply.
What I want ist do group a grid two times by two different colums. The header description of each group should contain additional data out of the grid. The group Key, and additional data picked out of the group items. Same situation as the average or sum functionality but in my case for character values.
The Header description values should be kept also in that case the grid wil be grouped by an other column.

I will try to submit you an example by creating a support ticket. Just start the sample. The sample itselve groups the grid by "Week" and the group header contains different values displayed in list controls. Please take the sample and group it a second time by "Day". The sample will now show the second group header but the first group header will loose all date except the group.key.

Thanks

Stefan
0
Vlad
Telerik team
answered on 02 Jun 2010, 07:22 AM
Hi,

As I said you cannot display low level data items in case of nested grouping in this way. You will get groups not items if this group contains sub groups. I'm not sure what is purpose of grouping at all if you want to display data items in the group header for every group. 

Best wishes,
Vlad
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
schneeflocke
Top achievements
Rank 1
answered on 03 Jun 2010, 09:31 AM
Hi,

the purpose of the request is to generate a grid in a layout generated like shown in the following link: http://www.sse-luzius.de/seelsorgeeinheit/gottesdienste.html

The content of the group header will not appear (visible = false) as a grid column. Only the real detail information will shown as as grid column. In the sample link you can see that the "first group criteria" is the Week and the "second group criteria" is the date.

The reason for using the grid is that the detail information should be editable (not the group header content).

Could it be a solution to generate a group.key with the whole group header, concatenate the "several items" to one key. So I need to use only the group key. But how can I then seperate the content of the group.key during the usage? Extracting substrings. something like that:

                                <StackPanel Orientation="Vertical" Margin="5,0">     
                                    <TextBlock Foreground="Green" Text="{Binding Group.Key}.Substring(0, 10)" />    
                                    <TextBlock Foreground="Green" Text="{Binding Group.Key}.Substring(11, 30)" />    
                                    <TextBlock Foreground="Green" Text="{Binding Group.Key}.Substring(31, 50)" />     
                                </StackPanel>  


Thanks for your continuous help and support

Stefan
0
Accepted
Pavel Pavlov
Telerik team
answered on 09 Jun 2010, 10:11 AM
Hi schneeflocke,

Since the binding will not help in multilevel grouping , i have slightly modified your sample application. i have placed a user control in the header and in the code behind there is some logic to check if the grouping is single level or not and extract the data from the subgroup if necessary.

Please use the sample attached as a starting point.

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.
Tags
GridView
Asked by
schneeflocke
Top achievements
Rank 1
Answers by
Vlad
Telerik team
schneeflocke
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or