Skip to main content

TcxGridTableViewStyles.OnGetFooterStyle Event

Occurs when it is necessary to paint View footer and group footer panels.

Declaration

property OnGetFooterStyle: TcxGridGetCellStyleEvent read; write;

Remarks

You can handle the OnGetFooterStyle event to change the styles of group and table footers on the fly.

Group footers allow you to display group summaries when data is grouped by column(s). The View footer resides at the bottom of a grid control and is used to display footer summaries. To show group and View footers, use the View’s OptionsView.GroupFooters and OptionsView.Footer properties.

When handling the OnGetFooterStyle event, you can distinguish between the View footer and group footers by comparing the ARecord parameter value with nil. For View footers, it will always contain nil. For group footers, ARecord will specify the last data record within the corresponding group.

A summary result corresponding to a particular column is drawn within a footer cell (a bordered rectangle region in the footer panel). If a footer cell is being painted, the AItem parameter specifies a non-nil value. In this case, it refers to the column containing the footer cell. If AItem contains nil, the entire footer panel is being painted.

The Sender parameter is the View containing the item.

The following code handles the OnGetFooterStyle event. Different styles are specified when the AItem and ARecord parameters contain nil and non-nil values.

procedure TForm1.tvOrdersStylesGetFooterStyle(
  Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
  AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
begin
  if Assigned(ARecord) then
    if Assigned(AItem) then
      AStyle := cxStyle1
    else
      AStyle := cxStyle2
  else
    if Assigned(AItem) then
      AStyle :=  cxStyle3
    else
      AStyle := cxStyle4
end;

Styles used in this example were created via a style repository of the TcxStyleRepository class. They specify colors as follows:

cxStyle1:

cxStyle2:

cxStyle3:

cxStyle4:

The result of this code is shown below:

You can use the OnGetFooterStyleEx event which represents the extended version of the OnGetFooterStyle event and should be handled whenever you need additional style customizations for the grouped items in the View.

Note

The column’s Styles.OnGetFooterStyle and Styles.OnGetFooterStyleEx events override the default style for the column footer which is stored in the column’s Styles.Footer property. The latter in turn overrides any style which is returned from the View’s OnGetFooterStyle and OnGetFooterStyleEx events which in turn override the style stored in the View’s Styles.Footer property.

See Also