Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomGridTableController.FocusedRecordIndex Property

Specifies the index of the focused record.

#Declaration

Delphi
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: Expand the Focused Group Row

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;
See Also