Back to Devexpress

TcxCustomDataController.GetSelectedRowIndex(Integer) Method

vcl-cxcustomdata-dot-tcxcustomdatacontroller-dot-getselectedrowindex-x28-system-dot-integer-x29.md

latest4.8 KB
Original Source

TcxCustomDataController.GetSelectedRowIndex(Integer) Method

Returns the row index of a selected row.

Declaration

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

Parameters

NameType
IndexInteger

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

TcxCustomDataController.ChangeRowSelection

TcxCustomDataController.CheckFocusedSelected

TcxCustomDataController.ClearSelection

TcxCustomDataController.DeleteSelection

TcxCustomDataController.FocusedRecordIndex

TcxCustomDataController.IsRowSelected

TcxCustomDataController.SelectAll

TcxCustomDataController.SelectRows

TcxCustomDataController.SyncSelected

TcxCustomGridRecord.Selected

TcxCustomGridTableController.ClearSelection

TcxCustomGridTableController.DeleteSelection

TcxCustomGridTableController.SelectedRecordCount

TcxCustomGridTableController.SelectedRecords

TcxCustomGridTableOptionsSelection.MultiSelect

Example: Changing Selected Records in Provider and Unbound Modes

TcxCustomDataController Class

TcxCustomDataController Members

cxCustomData Unit