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

    Expands all rows in the Pivot Table component.

    Namespace: DevExpress.Blazor.PivotTable

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

    Declaration

    public void ExpandAllRows()

    Remarks

    Call the ExpandAllRows or CollapseAllRows method to expand or collapse all rows 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 ExpandAllRows to ensure correct data operations.

    The following code adds two buttons: Collapse All Rows and Expand All Rows.

    @rendermode InteractiveServer
    
    <DxButton Text="Collapse All Rows" Click="OnCollapseClick" />
    <DxButton Text="Expand All Rows" Click="OnExpandClick" />
    <p/>
    
    <DxPivotTable Data="SalesData" class="h-460" @ref=MyPivotTable >
        <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" />
            <DxPivotTableField Field="@nameof(Sales.SaleInfo.City)"
                               Area="@PivotTableArea.Filter"/>
        </Fields>
    </DxPivotTable>
    
    @code {
        IPivotTable MyPivotTable { get; set; }
        PivotTablePersistentLayout Layout { get; set; }
        IEnumerable<Sales.SaleInfo> SalesData;
        protected override async Task OnInitializedAsync() {
            SalesData = await Sales.GetSalesAsync();
        }
    
        void OnCollapseClick() {
            MyPivotTable.CollapseAllRows();
        }
    
        void OnExpandClick() {
            MyPivotTable.ExpandAllRows();
        }
    }
    

    Pivot Table - Expand Collapse Rows

    Implements

    See Also