ExpandAllGroups throws NullReferenceException
Hi.
I'm using GridDataCotrol with groups. Every time I insert new data to it I want groups to be expanded. So I've found myGrid.Model.Table.ExpandAllGroups() method. But It throws NullReferenceException ({"Object reference not set to an instance of an object."}).
Here's some VS exception snapshot:
InnerException is null,
Source is Syncfusion.Grid.Wpf
Does anyone know what may be the issue here?
Thanks.
F.
I'm using GridDataCotrol with groups. Every time I insert new data to it I want groups to be expanded. So I've found myGrid.Model.Table.ExpandAllGroups() method. But It throws NullReferenceException ({"Object reference not set to an instance of an object."}).
Here's some VS exception snapshot:
InnerException is null,
Source is Syncfusion.Grid.Wpf
Does anyone know what may be the issue here?
Thanks.
F.
SIGN IN To post a reply.
3 Replies
MA
Manikandan
Syncfusion Team
April 1, 2011 01:50 PM UTC
Hi Flashman,
Thanks for using Syncfusion products
We have analyzed the reported issue with our samples , however, we do not get any exception while inserting new data, it
works fine and all groups are expanded. Could you please check with this sample and video from the following location.
Sample : http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Grouping_I1550148488.zip
Video : http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Group-1955870816.zip
In order to resolve the issue further, could you please share a simple sample or the steps to replicate this issue?
Please let us know if you have any further queries.
Regards,
Manikandan
Thanks for using Syncfusion products
We have analyzed the reported issue with our samples , however, we do not get any exception while inserting new data, it
works fine and all groups are expanded. Could you please check with this sample and video from the following location.
Sample : http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Grouping_I1550148488.zip
Video : http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Group-1955870816.zip
In order to resolve the issue further, could you please share a simple sample or the steps to replicate this issue?
Please let us know if you have any further queries.
Regards,
Manikandan
JA
Jakub
April 6, 2011 08:35 AM UTC
Thanks for the reply and example with video.
I should better examine and describe the problem. I was unable to expand the groups via code. To be exact if I had collapsed groups in datagrid and I used let's say a button to call the datagrid.Model.Table.ExpandAllGroups() it worked ok. But in my situation it threw that exception. More If I had somewhere in form constructor this code it threw the exception TargetInvocationException.
I mean for example if you use at the end of the contructor in MainWindow.xaml.cs this:
dataGrid1.ItemsSource = new Product();
dataGrid1.Model.Table.ExpandAllGroups();
and detele ItemsSource="..." in xaml
So to get rid of those problems I'm now using this code before asking for grid expanding:
if (u_dataGrid1.Model.TableProperties != null)
u_dataGrid1.Model.Table.ExpandAllGroups();
I'm not sure what was it about.. but now it works well.
I should better examine and describe the problem. I was unable to expand the groups via code. To be exact if I had collapsed groups in datagrid and I used let's say a button to call the datagrid.Model.Table.ExpandAllGroups() it worked ok. But in my situation it threw that exception. More If I had somewhere in form constructor this code it threw the exception TargetInvocationException.
I mean for example if you use at the end of the contructor in MainWindow.xaml.cs this:
dataGrid1.ItemsSource = new Product();
dataGrid1.Model.Table.ExpandAllGroups();
and detele ItemsSource="..." in xaml
So to get rid of those problems I'm now using this code before asking for grid expanding:
if (u_dataGrid1.Model.TableProperties != null)
u_dataGrid1.Model.Table.ExpandAllGroups();
I'm not sure what was it about.. but now it works well.
MA
Manikandan
Syncfusion Team
April 7, 2011 06:58 AM UTC
Hi Jakub,
Thanks for your update.
Normally the ItemSource gets loaded to the grid once after the Model loaded. You can achieve your requirement by calling the ExpandAllGroups() method in grid Loaded event.
Please refer the below code snippet:
code[C#]
this.dataGrid1.Loaded += new RoutedEventHandler(dataGrid1_Loaded);
void dataGrid1_Loaded(object sender, RoutedEventArgs e)
{
this.dataGrid1.Model.Table.ExpandAllGroups();
}
We have prepared a sample based on this and you can find the sample from the following location:
Sample: http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Grouping_I65375484.zip
Please let us know if you have any queries.
Regards,
Manikandan
Thanks for your update.
Normally the ItemSource gets loaded to the grid once after the Model loaded. You can achieve your requirement by calling the ExpandAllGroups() method in grid Loaded event.
Please refer the below code snippet:
code[C#]
this.dataGrid1.Loaded += new RoutedEventHandler(dataGrid1_Loaded);
void dataGrid1_Loaded(object sender, RoutedEventArgs e)
{
this.dataGrid1.Model.Table.ExpandAllGroups();
}
We have prepared a sample based on this and you can find the sample from the following location:
Sample: http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Grouping_I65375484.zip
Please let us know if you have any queries.
Regards,
Manikandan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JA Jakub
- Mar 31, 2011 10:37 AM UTC
- Apr 7, 2011 06:58 AM UTC