)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the behavior of the groups are not collapse when changing the WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: May 13, 2015 |
Last Revised Date: December 24, 2019
Tags: grouping

Grouping

While modifying the content of the grouped records, the groups are not getting collapsed in the version 13.1.0.X (2015 Volume 1) of the Essential studio.

Solution

From the 13.1.0.X version of Essential Studio, the default behavior is, when a group is added or modified it does not collapse all the other groups.

To collapse the entire group, except the distinct group created by adding or modifying the record, set the TableDirty property value as “true” in SourceListListChanged event. When a table is marked dirty, any subsequent access to child elements and a resulting Syncfusion.Grouping.Element.EnsureInitialized(System.Object) call triggers re-categorization of all records in the table.

C#

//Hook the event in Form()to set the table value as dirty.
this.gridGroupingControl1.SourceListListChanged += new TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged);
void gridGroupingControl1_SourceListListChanged(object sender, TableListChangedEventArgs e)
{
    //Set the table as dirty
    e.Table.TableDirty = true;
}

VB

'Hook the event in Form()to set the table value as dirty.
Private Me.gridGroupingControl1.SourceListListChanged += New TableListChangedEventHandler(AddressOf gridGroupingControl1_SourceListListChanged)
Private Sub gridGroupingControl1_SourceListListChanged(ByVal sender As Object, ByVal e As TableListChangedEventArgs)
   'Set the table as dirty
   e.Table.TableDirty = True
End Sub

The following screenshot illustrates only the new group in the table.

Show the new group in table

Figure 1: New group in table

Samples:

C#: Grouping 

VB: Grouping

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon