A GridControl presents its data with the help of rows and columns. This document provides an overview of row types available in the grid. To get detailed information on grid columns, review the Columns section.
A data source represents tabular information using data fields and records. A GridControl bound to a data source displays data fields as columns, and records as data rows. These rows are displayed one after another. Record values are arranged horizontally within them.
All rows have the same height. You can set it manually, using the GridControl.RowHeight property.
Each row is identified by a unique integer value - row handle. Data row handles start from zero. You can access data values in a row using the GridControl.GetCellValue, GridControl.SetCellValue and GridControl.GetRow methods with the passed handle of the required data row.
When an end-user taps a data row in the grid, this row is selected. To set a selected row programmatically, use the GridControl.SelectedRowHandle method.
When grouping is applied in a GridControl, the grid displays group rows. These rows function to separate data row groups and can also be expanded and collapsed to show and hide data rows that belong to a group.
Rows are always sorted against the grouping column. If data is grouped against a column which is not sorted, the grid will automatically apply sorting to the column in ascending order.
A group row displays the following elements:
- Group Expand Icon - Indicates whether the group is expanded or collapsed.
- Grouping Column - A caption of a column by whose values data is grouped.
- Group Row Value - A data value of a grouping column for which the group is created.
- Group Summary - A group summary value.
Each group row is identified by a unique integer value - row handle. Group row handles are negative (starting from -1). You can obtain detailed information on an individual data group using the GridControl.GetGroupInfo method with the corresponding group row handle passed as a parameter. This method returns an object implementing the IGroupInfo interface that provides a set of properties to get information on a particular data group. For example, the following table lists properties that you can use to get information displayed in the specified group row.
|IGroupInfo.FieldName||Gets the field name of the column by which data is grouped.|
|IGroupInfo.Value||Gets the value for which the group is created (a value which is displayed in a group row).|
|IGroupInfo.Summaries||Gets the list of objects that contain information on group summaries calculated for the data group and displayed within the group row.|
|IGroupInfo.IsCollapsed||Indicates whether the group is collapsed.|
When an end-user taps a group row, this group is collapsed or expanded. You can disable this functionality by setting the GridControl.AllowGroupCollapse property to false. To collapse or expand group rows programmatically, use the GridControl.CollapseGroupRow, GridControl.CollapseAllGroups, GridControl.ExpandGroupRow or GridControl.ExpandAllGroups method. The GridControl.GroupsInitiallyExpanded property allows you to specify whether groups should appear expanded or collapsed immediately after a grouping is applied in the grid.
Before a group row is collapsed or expanded, the grid raises the GridControl.GroupRowCollapsing or GridControl.GroupRowExpanding event, allowing you to cancel the corresponding operation. After a group row has been collapsed or expanded, the grid notifies you by raising the GridControl.GroupRowCollapsed or GridControl.GroupRowExpanded event.
When an end-user taps and holds a group row, a context menu appears allowing end-users to manage groups (calculate group summaries, collapse and expand all groups at once, and remove grouping from the grid). To prevent this menu from being shown, set the GridControl.IsGroupRowMenuEnabled property to false.