The rows of a grid are represented by objects that derive from the base NRow abstract class. The rows of a grid are contained in a NRowCollection element that is accessible from the Rows property of NGrid. The rows of the grid are created or rebuilt when the grid is updated to reflect any changes in the data source, grouping, filtering, sorting etc. The following code example gets the rows of a grid:
Getting The Rows |
Copy Code
|
// make sure the grid is updated
grid.Update();
// get the collection of rows
NRowCollection rows = grid.Rows;
|
The rows of both the
Tree Grid and the
Table Grid are hierarchically organized. This means that certain rows may have child rows.
The following image shows the current NRow class hierarchy:
Following is some information about the different types of rows:
- NRow - this is the base class for all rows.
- NHierarchicalRow - serves as base class for rows, the expandable content of which is other rows - i.e. all rows that can contain other rows.
-
NDataRow - serves as base class for rows, which represent data source rows. The content of a NDataRow is a collection of NDataCell instances. For performance reasons the grid only creates the data cells for the data rows that are inside the current grid viewport. This is known as virtualization. Virtualization greatly improves the performance of the grid, and makes it possible for it to handle thousands of rows. The NGrid base class manages a map between the data row index and the data row, like shown in the following example:
Getting the data row for a specific index |
Copy Code
|
// get the data row that represents data source row with index 10
NDataRow dataRow = grid.GetDataRow(10);
|
- NRecordDataRow - this is the type of data row that is created for the data source rows in the Table Grid. The expandable content of the NRecordDataRow can be NDetailsRow instances, that enable the creation of Master - Details scenarios.
- NTreeDataRow - this is the type of data row that is created for the data source rows in the Tree Grid. The expandable content of the NTreeDataRow are other NTreeDataRow instances.
- NGroupRow - this type of row is created by the grouping rules, for each group of records. The content of a group row is a collection of NGroupRowCell instances that are produced by the NGroupingRule - see Grouping for more information.
- NSummaryRow - this is a non-expandable row, the content of which is a collection of NSummaryCell instances. The summary rows are optionally created by a respective NGroupingRule. See Grouping for more information.
- NDetailsRow - this is a non-expandable row which is created by the Master - Details scenarios.