TcxCustomGridRecord Class
Represents the base class for records in a View.
Declaration
TcxCustomGridRecord = class(
TObject
)
Remarks
TcxCustomGridRecord is the base class representing a single record displayed within a View. Records can be accessed via the View’s ViewData object and this provides the Records collection (Cards in TcxGridCardViewViewData and Rows in TcxGridViewData). Records retrieve information from a data controller assigned to the View but do not implement posting data back. To change cell values in bound mode, use the methods of the TDataSet object. In unbound mode, use the View’s DataController.Values property for this purpose.
A ViewData object reflects the current visual arrangement of records. It contains only the records actually displayed within a View. If record(s) are hidden within collapsed groups, they are not contained in the Records collection.
There are several types of records in a View. They are all descendants of the TcxCustomGridRecord class.
a card (TcxGridCard) – represents a record in a Card View.
a grid group row (TcxGridGroupRow) is a row displaying a value of an item (column) by which data is grouped. It can display group summaries, if any.
a grid data row (TcxGridDataRow) displaying the actual data
a grid master data row (TcxGridMasterDataRow) is a data (non-group) row in a master View
a new item row (TcxGridNewItemRow) represents a row for entering new data
Using members of the TcxCustomGridRecord class, you can:
access values of specific record fields;
determine the index, record index, and level of the record;
set focus to a record within a View;
expand the record (only for master and group rows);
etc.
TcxCustomGridRecord introduces base functionality common to all types of records. First, a record is identified by its position. The order in which records are retrieved from the data controller is determined by the record index. Record indexes are not affected by sorting or grouping of data. They always refer to the same data. Unlike the record index, index defines the visible order of records within a View.
The following image shows a sample grid control with five records retrieved from the data without doing anything to change the display order. Indexes and record indexes have the same values for every record.
When records are grouped by BirthCountry and sorted by the FirstName column in descending order, only the visual record order changes. Index identifies the current visual position while the record index keeps its original value.
Every record displays values. A data row, master data row and a card display values corresponding to data items (columns in a Table View or rows in a Card View). A group row displays a value of the item (column) by which the View data is grouped. The values presented by the record are defined by the Values property. You can access the text version of a value via the DisplayTexts property.
When you group data, a hierarchical structure of records is created. In this case, group records of the TcxGridGroupRow class are created. The group level (the Level property) identifies the position of a record in this hierarchy.