Skip to main content
All docs
V24.2

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

[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