Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxPivotTable.Fields Property

A collection of Pivot Table fields.

Namespace: DevExpress.Blazor.PivotTable

Assembly: DevExpress.Blazor.PivotTable.v24.2.dll

NuGet Package: DevExpress.Blazor.PivotTable

#Declaration

C#
[Parameter]
public RenderFragment Fields { get; set; }

#Property Value

Type Description
RenderFragment

A collection of Pivot Table fields (UI fragment).

#Remarks

DxPivotTableField objects supply data to Pivot Table areas: columns, rows, and data cells.

Pivot Table Areas

Follow the steps below to add fields to a Pivot Table:

  1. Add <Fields>...</Fields> tags to the component markup to define the Fields collection.
  2. Add DxPivotTableField objects to the collection. Use the Area property to specify the area where the field is displayed:
    • Row: The field caption is displayed as a row header. Field values are displayed as rows.
    • Column: The field caption is displayed as a column header. Field values are displayed as columns.
    • Data: The field caption is displayed in the header area. Field values are used to calculate summaries displayed in data cells.
  3. Optional. Set up additional field properties: AreaIndex, Caption, SummaryType (for data fields), and others.
@rendermode InteractiveServer

<DxPivotTable Data="SalesData">
    <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>

@code {
    IEnumerable<SaleInfo> SalesData;
    protected override async Task OnInitializedAsync() {
        SalesData = await Sales.GetSalesAsync();
    }
}
See Also