Group Header - row data in group header

12 posts, 1 answers
  1. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 20 May 2010 Link to this post

    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
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 21 May 2010 Link to this post

    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.
  3. DevCraft banner
  4. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 22 May 2010 Link to this post

    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> 
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 May 2010 Link to this post

    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.
  6. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 27 May 2010 Link to this post

    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
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 May 2010 Link to this post

    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.
  8. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 28 May 2010 Link to this post

    Hi,

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

    Thanks

    Stefan
  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 31 May 2010 Link to this post

    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.
  10. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 01 Jun 2010 Link to this post

    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
  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 02 Jun 2010 Link to this post

    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.
  12. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 03 Jun 2010 Link to this post

    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
  13. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 09 Jun 2010 Link to this post

    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.
Back to Top
DevCraft banner