Using ColumnGroupDescriptor

6 posts, 1 answers
  1. Jack
    Jack avatar
    14 posts
    Member since:
    Sep 2011

    Posted 24 Nov 2011 Link to this post

    Hi, I'm trying to add Group by column (using code behind) by doing:

    ColumnGroupDescriptor NewDescriptor = new ColumnGroupDescriptor();
    NewDescriptor.Column = MainDataGrid.Columns[i];   // i is some number index

    MainDataGrid.GroupDescriptors.Add(NewDescriptor);


    And when the grid loads, I can see the Name of the column at the top panel, as if it has been grouped by that column, but no data is showing in the grid.

    If now, I click on that name of the column at the top panel, the grid reloads and i can see the data.

    Or if, I drag another column name into the top panel (the panel that usually says drag column here to group), now the grid reloads and the data is grouped by both columns.


    So what is causing it to not show data when it first loads?


    Any help would be appreciated
    Thanks
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 25 Nov 2011 Link to this post

    Hello Jack,

    Could you provide a bit more information about your exact scenario ? Is the data loaded initially ? Is the solution suggested in this forum thread appropriate for you ?


    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Jack
    Jack avatar
    14 posts
    Member since:
    Sep 2011

    Posted 25 Nov 2011 Link to this post

    Thank you so much!!!!

    This helped alot!!!
  4. Laurent
    Laurent avatar
    5 posts
    Member since:
    Apr 2012

    Posted 03 Apr 2012 Link to this post

    Hi,

    I'm having the same issue as described by Jack, but the other thread didn't solve my problem.

    I'm actually declaring the group descriptor into xaml as below

                <telerik:RadGridView ItemsSource="{Binding DataItems}">
                    <telerik:RadGridView.ColumnGroups>
                        <telerik:GridViewColumnGroup  Name="FOM" Header="FOM" />
                        <telerik:GridViewColumnGroup  Name="GDA" Header="GDA" />
                    </telerik:RadGridView.ColumnGroups>
                    
                    <telerik:RadGridView.Columns>
                         <telerik:GridViewDataColumn DataMemberBinding="{Binding FlowDate, StringFormat=\{0:dd\}}"  UniqueName="FlowDateUid"
                                                    IsReadOnly="True" Header="Flow Date" />
                    </telerik:RadGridView.Columns>
                    <telerik:RadGridView.GroupDescriptors>
                        <telerik:ColumnGroupDescriptor Column="{Binding Path=Columns[\FlowDateUid\], ElementName=dataGrid}" />
                    </telerik:RadGridView.GroupDescriptors>
                </telerik:RadGridView>

    The data context is loaded asynchronously and the items source of the data grid is setted some time after grid initialisation.

    When the grid is displayed my filter is setted and i can see the columns header but no data.
    When i click on the filter, i can see the data properly.

    It seems that when a group descriptor is setted before an item source is loaded the filter doesn't applies properly.
    Is it a bug or am i making something wrong?

    Any help would be appreciated
    Thanks

  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 03 Apr 2012 Link to this post

    Hi Laurent,

    Could you take a look at the sample attached and try to get the same behavior as the one on your application ? How do you define your filter descriptors ? Am I missing something in my project ? 

    Greetings,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Laurent
    Laurent avatar
    5 posts
    Member since:
    Apr 2012

    Posted 03 Apr 2012 Link to this post

    Hi,

    thanks for your quick reply.
    I just solved my issued. it was due to a binding problem.

    When i update my itemSource (observableCollection) using MyCollection.Add(myItem); the file descriptor is not working.

    Using a temporary observable collection and add all my updated items in it makes it work.

    Regards,
    Laurent
Back to Top