TcxCustomGridTableController.FocusedRecordIndex Property
Specifies the index of the focused record.
Declaration
property FocusedRecordIndex: Integer read; write;
Property Value
Type | Description |
---|---|
Integer | The focused record’s index. |
Remarks
You can use the FocusedRecordIndex
property to focus a record.
When the View loads all records from a data source (the GridMode property is set to False), FocusedRecordIndex specifies the record position relative to the top View record.
In grid mode, a data controller loads only a fixed number of records into a memory buffer. When you scroll the View contents and reach the end of the buffer, the data controller loads the next portion of records and focus is moved to a record within the new buffer.
Use the FocusedRecord property to access the record rather than its index. The Focused/Selected Records document provides more information related to focused records.
Code Example
The following code example expands the focused group row:
var
AView: TcxCustomGridTableView;
//...
AView := TcxCustomGridTableView(Grid.FocusedView);
if AView.Controller.FocusedRecord is TcxGridGroupRow then
begin
AView.Controller.FocusedRecord.Expand(True);
AView.Controller.FocusedRecordIndex := AView.Controller.FocusedRecordIndex +
AView.GroupedItemCount - FocusedRecord.Level;
end;