Back to Devexpress

DxPivotGridField.Field Property

blazor-devexpress-dot-blazor-dot-dxpivotgridfield-a02eeb2c.md

latest2.6 KB
Original Source

DxPivotGridField.Field Property

Specifies the name of the database field that is assigned to the current object.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public string Field { get; set; }

Property Value

TypeDescription
String

A String value that is the name of the data field.

|

Remarks

Important

The Pivot Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Pivot Table component.

Use the following syntax to connect a Pivot Grid field with a data source field:

razor
<DxPivotGrid Data="@PivotGridData">
    <DxPivotGridField Field="@nameof(SaleInfo.City)" Area="PivotGridFieldArea.Row"></DxPivotGridField>
    <DxPivotGridField Field="@nameof(SaleInfo.Date)" GroupInterval="PivotGridGroupInterval.Year" Area="PivotGridFieldArea.Column" Caption="Year"></DxPivotGridField>
    <DxPivotGridField Field="@nameof(SaleInfo.Amount)" Area="PivotGridFieldArea.Data" SummaryType="PivotGridSummaryType.Sum"></DxPivotGridField>
</DxPivotGrid>

You can also bind a Pivot Grid column to a complex field (a field that belongs to a data source object’s nested object). A complex field name is constructed via the DataSourceObject.Name1.Name2 structure. To bind a column to a complex field (CompanyName in the example below), use the following approach:

razor
@{ var CompanyName = $"{nameof(Order.CompanyInfo)}.{nameof(Company.Name)}"; }

<DxPivotGrid Data="@Orders">
    <DxPivotGridField Field="@nameof(Order.ProductName)" Area="PivotGridFieldArea.Row"></DxPivotGridField>
    <DxPivotGridField Field="@CompanyName" Area="PivotGridFieldArea.Column"></DxPivotGridField>
    ...
</DxPivotGrid>

@code {

    IEnumerable<Order> Orders;

    public class Order {
        public int ID { get; set; }
        public string ProductName { get; set; }
        public Company CompanyInfo { get; set; } = new Company();
    }

    public class Company {
        public string Name { get; set; }
        public string Address { get; set; }
    }
}

See Also

DxPivotGridField Class

DxPivotGridField Members

DevExpress.Blazor Namespace