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

Hide caption Summary Row on expand collapse

Hi,

How to toggle visible property of the gridgrouping control on Groupexpand/Collapse event. I want to hide the summarycaptionrow of the group when expand.

Thanks
Harshad

5 Replies

AD Administrator Syncfusion Team January 19, 2007 03:51 PM UTC

Hi Harshad,

Use ShowCaptionSummaryCells property to hide/show the Caption summary row in a grid. Here is a code snippet

//To hide the main table Captionsummary row.
this.gridGroupingControl1.TopLevelGroupOptions.ShowCaptionSummaryCells = false;

//To hide the nested table Captionsummary row.
this.gridGroupingControl1.NestedTableGroupOptions.ShowCaptionSummaryCells = false;

//To hide all groups Captionsummary row.
this.gridGroupingControl1.ChildGroupOptions.ShowCaptionSummaryCells = false;

//To hide a particular grouped column Captionsummary row.
this.gridGroupingControl1.TableDescriptor.Columns[ GroupByField ].GroupByOptions.ShowCaptionSummaryCells = false;

Best Regards,
Haneef


AD Administrator Syncfusion Team January 19, 2007 04:06 PM UTC

Actually I want to hide the summary for the group row which is expanded.
i.e If i have 2 group values and I expanded first group row then only caption summary row of that group section should be hidden. while second group value(for same group column)which is still collapsed should be visible


AD Administrator Syncfusion Team January 19, 2007 05:30 PM UTC

Hi Harshad,

You would have to derive a class from GridGroup. In your derived classes you need to override IsChildVisible.

Something like this:

public override bool IsChildVisible(Element el)
{
if (el is CaptionSection && this.IsExpanded )
return false;
else
return base.IsChildVisible(el);// Otherwise default behavior:
}

Here is a minimal sample that shows how to hide the expanded group caption summary row in a grid.
GGCHideshowSummaries.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team January 22, 2007 12:45 PM UTC

Hi,

Thanks for the details....now i am close to what i am expecting grid should behave.

In the example given by you, IT removed caption bar totally....I dont want to remove the caption text i.e grouping element with +/- . I just want to clear summary columns next to the caption text for that grouping value.

Please look into this . Your help is highly appriciated

Thanks


AD Administrator Syncfusion Team January 22, 2007 05:49 PM UTC

Hi Harshed,

You can handle the TableModel.QueryCoveredRange event and set the e.Range for expanded groupcaption cell. Here is a code snippet.

private void TableModel_QueryCoveredRange(object sender, GridQueryCoveredRangeEventArgs e)
{
GridTableModel model = sender as GridTableModel;
Element el = model.Table.DisplayElements[e.RowIndex];

if( el.ParentGroup != null && el.ParentGroup.IsExpanded )
{
GridTableCellStyleInfo style = model[e.RowIndex,e.ColIndex] as GridTableCellStyleInfo;
if( style != null
&& style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell )
{
e.Range = GridRangeInfo.Cells(e.RowIndex,e.ColIndex,e.RowIndex,model.ColCount);
e.Handled = true;
}
}
}


Please refer to the attached sample for implementation.
GGCHideshowSummaries.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon