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

TcxDataSummaryItems.DataController Property

Provides access to the parent data controller.

#Declaration

Delphi
property DataController: TcxCustomDataController read;

#Property Value

Type Description
TcxCustomDataController

The parent data controller.

You may need to cast the property value to the corresponding terminal TcxCustomDataController class descendant to access all public API members.

Tip

Call the DataController.ClassType function to identify the actual data controller type.

#Remarks

Use DataController and Summary properties to access parent data and summary controllers.

#Code Example: Custom Summary Calculation

All predefined summary calculation algorithms use record values of only one data item. The OnSummary event allows you to modify a predefined summary calculation algorithm in any manner. For example, you can use values of multiple data items in every iteration of the summary calculation process.

The code example below demonstrates an OnSummary event handler that modifies the predefined algorithm MAX. The event handler calculates the highest population density based on data-aware grid columns that display country areas (DBTableView1Area) and corresponding population values (DBTableView1Population):

procedure TMyForm.cxGrid1DBTableView1DataControllerSummaryDefaultGroupSummaryItemsSummary(
  ASender: TcxDataSummaryItems; Arguments: TcxSummaryEventArguments;
  var OutArguments: TcxSummaryEventOutArguments);
var
  AArea, APopulation: Variant;
begin
  // Obtain the area value for the currently processed record
  AArea := ASender.DataController.Values[Arguments.RecordIndex, DBTableView1Area.Index];
  // Obtain the population value for the currently processed record
  APopulation := ASender.DataController.Values[Arguments.RecordIndex, DBTableView1Population.Index];
  OutArguments.Value := APopulation/AArea; // Calculates the custom summary value (maximum population density)
end;
See Also