This is a migrated thread and some comments may be shown as answers.
Using ColumnGroupDescriptor
5 Answers 166 Views
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 24 Nov 2011, 07:56 PM
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

5 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 25 Nov 2011, 09:51 AM
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 >>

0
Jack
Top achievements
Rank 1
answered on 25 Nov 2011, 03:08 PM
Thank you so much!!!!

This helped alot!!!
0
Laurent
Top achievements
Rank 1
answered on 03 Apr 2012, 01:58 PM
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

0
Maya
Telerik team
answered on 03 Apr 2012, 04:47 PM
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 >>
0
Laurent
Top achievements
Rank 1
answered on 03 Apr 2012, 05:57 PM
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
Asked by
Jack
Top achievements
Rank 1
Answers by
Maya
Telerik team
Jack
Top achievements
Rank 1
Laurent
Top achievements
Rank 1
Share this question
or