Skip to main content
All docs
V26.1
  • DxPivotTable.ExpandAllGroups() Method

    Expands all groups in the Pivot Table component.

    Namespace: DevExpress.Blazor.PivotTable

    Assembly: DevExpress.Blazor.PivotTable.v26.1.dll

    Declaration

    public void ExpandAllGroups()

    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.

    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 ExpandAllGroups 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