Skip to main content

TcxCustomDataController.GetSelectedRowIndex(Integer) Method

Returns the row index of a selected row.

Declaration

function GetSelectedRowIndex(Index: Integer): Integer; virtual;

Parameters

Name Type
Index Integer

Returns

Type
Integer

Remarks

The GetSelectedRowIndex function returns the row index of a selected row. Row indexes define the order in which rows (data records and grouping rows) appear in the data controller. See the TcxCustomDataController topic for information on row indexes.

The Index parameter addresses a particular selected row by its position within the collection of all selected rows. Index can vary from 0 to GetSelectedCount - 1.

GetSelectedRowIndex returns valid row indexes for selected rows only in provider, unbound and default bound modes.

In grid mode, the data controller does not load all records from the underlying dataset. It loads only a fixed number of records at once into the memory buffer and its size is determined by the GridModeBufferCount property. The data controller indexes only the records falling within the current buffer. Other records are not assigned row & record indexes. If a particular row does not belong to the current buffer, the GetSelectedRowIndex function returns -1. Otherwise, GetSelectedRowIndex returns the row index of the selected record relative to the first record in the buffer.

To access all selected records in grid mode, use the GetSelectedBookmark function.

The row index retrieved by the method can be used to:

To iterate selected rows, you can also use the ForEachRow method. This can be applied in all loading modes.

The MultiSelect topic provides more information on selecting rows.

See Also