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. Image for the cookie policy date
close icon

Automatically Hiding Group By Column

Is there a property of the GGC that will automatically hide the column when the grid is grouped by that column. e.g. if my grid is grouped by date it seems logical that you may not be want to see the date column (since you can see from the group header what the date is).

If not how would I go about hiding the currently grouped column?

1 Reply

AD Administrator Syncfusion Team February 26, 2007 03:41 PM UTC

Hi Joel,

You can handle the GroupedColumns.Changing event of the grid and use the VisibleColumns property of the grid to manage the display columns of the grid. Here is a code snippet.

this.gridGroupingControl1.TableDescriptor.GroupedColumns.Changing +=new Syncfusion.Collections.ListPropertyChangedEventHandler(GroupedColumns_Changing);

private void GroupedColumns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
switch( e.Action)
{
case Syncfusion.Collections.ListPropertyChangedType.Insert:
SortColumnDescriptor icolumn = e.Item as SortColumnDescriptor;
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove(icolumn.Name);
break;
case Syncfusion.Collections.ListPropertyChangedType.Remove:
SortColumnDescriptor rcolumn = e.Item as SortColumnDescriptor;
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add(rcolumn.Name);
break;
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon