- 3 minutes to read
The DXGrid allows data to be grouped by an unlimited number of columns. When a View is grouped by a single column, data rows that have identical values in this column are arranged into groups. Each group is identified by a group row. If the View is grouped by another column, data rows within each group are arranged into second level groups based on the values of the new grouping column, etc.
Group rows are used to organize data rows into a tree when data grouping is applied. Each group row is assigned a unique integer value - row handle. Group row handles are negative (starting from -1).
Rows are always sorted against the grouping columns. If data is grouped against a column which isn't sorted, the grid will automatically apply sorting to the column in ascending order.
Grouping columns can be accessed via the GridViewBase.GroupedColumns property. This property returns the list of grouping columns, allowing individual columns to be accessed using indexed notation.
By default, grouping columns are not displayed within a View. Their headers are displayed within the Group Panel. To show these columns from a View, set the GridViewBase.ShowGroupedColumns property to true.
It is possible to hide the group row for groups that consist of a single row. To do this, set the TableView.AllowPartialGrouping property to true. When this option is enabled, grouped columns are displayed within a view regardless of the current value of the GridViewBase.ShowGroupedColumns property. This feature is not compatible with the Instant Feedback UI Mode.
End-users can group data in two ways:
- Drag a column's header to the group panel (requires the GridViewBase.ShowGroupPanel property to be set to true).
- Invoke a column's context menu by right-clicking its header, and select the Group By This Column menu item.
Both methods are allowed if the view's GridViewBase.AllowGrouping property is set to true.
Individual columns provide the GridColumn.AllowGrouping property, allowing the default behavior specified by the view to be overridden. For example, this allows preventing an end-user from grouping data by the values of individual columns.
Data grouping requires data sorting to be performed. End-users can only group data if data sorting is allowed (DataViewBase.AllowSorting).
- Grouping in Code
- Processing Group Rows
- Group Modes and Custom Grouping
- Expanding and Collapsing Group Rows
- Identifying Rows and Cards
- Fixed Group Rows