DxPivotTable.CollapseAllGroups() Method
Collapses all groups in the Pivot Table component.
Namespace: DevExpress.Blazor.PivotTable
Assembly: DevExpress.Blazor.PivotTable.v24.2.dll
NuGet Package: DevExpress.Blazor.PivotTable
Declaration
public void CollapseAllGroups()
Remarks
The Blazor Pivot Table automatically groups data data if row or column areas include multiple fields. All groups expand on data load. You can set the AutoExpandGroups property to false
to collapse groups. You can also use the ExpandAllGroups or CollapseAllGroups
methods to expand/collapse all groups in the Pivot Table component.
@rendermode InteractiveServer
<DxPivotTable Data="SalesData" @ref="PivotTable">
<Fields>
<DxPivotTableField Field="@nameof(SaleInfo.Region)"
Area="@PivotTableArea.Row"
AreaIndex="0" />
<DxPivotTableField Field="@nameof(Sales.SaleInfo.Country)"
Area="@PivotTableArea.Row"
SortOrder="@PivotTableSortOrder.Descending"
AreaIndex="1" />
<DxPivotTableField Field="@nameof(Sales.SaleInfo.Date)"
GroupInterval="@PivotTableGroupInterval.DateYear"
Area="@PivotTableArea.Column"
AreaIndex="0"
Caption="Year" />
<DxPivotTableField Field="@nameof(Sales.SaleInfo.Date)"
GroupInterval="@PivotTableGroupInterval.DateQuarter"
Area="@PivotTableArea.Column"
AreaIndex="1"
Caption="Quarter" />
<DxPivotTableField Field="@nameof(Sales.SaleInfo.Amount)"
SortOrder="@PivotTableSortOrder.Ascending"
Area="@PivotTableArea.Data"
SummaryType="@PivotTableSummaryType.Sum" />
</Fields>
</DxPivotTable>
<p></p>
<DxToolbar>
<Items>
<DxToolbarItem Text="Collapse Groups" Click="() => PivotTable.CollapseAllGroups()" />
<DxToolbarItem Text="Expand Groups" Click="() => PivotTable.ExpandAllGroups()" />
</Items>
</DxToolbar>
@code {
IPivotTable PivotTable { get; set; }
IEnumerable<SaleInfo> SalesData;
protected override async Task OnInitializedAsync() {
SalesData = await Sales.GetSalesAsync();
}
}
Implements
See Also