Skip to main content

TcxPivotGridField.ExpandAll Method

Expands all the columns or rows that correspond to the current field.

Declaration

procedure ExpandAll;

Remarks

When the current field is placed within the column header area the ExpandAll method expands all the grouping columns that correspond to this field.

When the current field is placed within the row header area the ExpandAll method expands all the grouping rows that correspond to this field.

To expand or collapse a specific grouping item (a grouping row or column), you need to locate it within the pivot grid’s ViewData display information and set the item’s Expanded property to an appropriate value.

The following code snippet demonstrates how to expand the grouping row that corresponds to a grouping value of 1 of the DBPivotGridPurchaseDate field.

var
  AGroupItem: TcxPivotGridGroupItem;
begin
  // ...
  DBPivotGrid.BeginUpdate;
  with DBPivotGrid.ViewData do
  begin
    for I := 0 to RowCount - 1 do
    begin
      AGroupItem := Rows[I].GetGroupItemByField(DBPivotGridPurchaseDate);
      if (AGroupItem <> nil) and (AGroupItem.Value = 1) then
      begin
        AGroupItem.Expanded := True;
        break;
      end;
    end;
  end;
  DBPivotGrid.EndUpdate;
end;
See Also