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

    Expands all columns in the Pivot Table component.

    Namespace: DevExpress.Blazor.PivotTable

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

    Declaration

    public void ExpandAllColumns()

    Remarks

    Call the ExpandAllColumns or CollapseAllColumns method to expand or collapse all columns 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 ExpandAllColumns to ensure correct data operations.

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

    @rendermode InteractiveServer
    
    <DxButton Text="Collapse All Columns" Click="OnCollapseClick" />
    <DxButton Text="Expand All Columns" 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.CollapseAllColumns();
        }
    
        void OnExpandClick() {
            MyPivotTable.ExpandAllColumns();
        }
    }
    

    Pivot Table - Expand Collapse Columns

    Implements

    See Also