Articles in this section
Category / Section

How to Expand/Collapse the group on Group Caption Cell click

1 min read

GridDataControl's CellClick event enables you to capture cell click event. By hooking this event you can expand or collapse particular group using ExpandGroup or CollapseGroup method respectively. Refer the following code sample to Expand/Collapse the group while clicking anywhere in the Caption Cell.

C#

this.dataGrid.CellClick += new GridCellClickEventHandler(dataGrid_CellClick);
void dataGrid_CellClick(object sender, GridCellClickEventArgs e)
{
    if (e.ClickCount == 2)
 { var style = this.dataGrid.Model[e.RowIndex, e.ColumnIndex] as GridDataStyleInfo;
  var CellIdentity = style.CellIdentity;
     if (CellIdentity.TableCellType==GridDataTableCellType.GroupCaptionSummaryTitleCell
|| CellIdentity.TableCellType == GridDataTableCellType.GroupCaptionSummaryRecordCell
 || CellIdentity.TableCellType == GridDataTableCellType.GroupCaptionSummaryCoveredCell
   || CellIdentity.TableCellType == GridDataTableCellType.GroupCaptionSummaryEmptyCell)
        {
            if (CellIdentity.Group.IsExpanded)
            {
                this.dataGrid.Model.Table.CollapseGroup(CellIdentity.Group);
            }
            else
            {
                this.dataGrid.Model.Table.ExpandGroup(CellIdentity.Group);
            }
        }
    }
}

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied