DxPivotTable.CollapseAllGroups() Method
Collapses all groups in the Pivot Table component.
Namespace: DevExpress.Blazor.PivotTable
Assembly: DevExpress.Blazor.PivotTable.v26.1.dll
Declaration
public void CollapseAllGroups()
Remarks
The Blazor Pivot Table automatically groups data when multiple fields are added to row or column areas. All groups are expanded when data is loaded. 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.
Note
When bound to a Server Mode data source, the Pivot Table loads data asynchronously in small portions (instead of the entire dataset). Call the WaitForDataLoadAsync method before you execute CollapseAllGroups to ensure correct data operations.
@rendermode InteractiveServer
<DxPivotTable Data="SalesData" @ref="PivotTable">
<Fields>
<DxPivotTableField Field="@nameof(Sales.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