DxPivotTableField.HeaderTemplate Property
Specifies a template to display the current field’s caption.
Namespace: DevExpress.Blazor.PivotTable
Assembly: DevExpress.Blazor.PivotTable.v24.2.dll
NuGet Package: DevExpress.Blazor.PivotTable
Declaration
[Parameter]
public RenderFragment<PivotTableFieldHeaderTemplateContext> HeaderTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment<PivotTableFieldHeaderTemplateContext> | The template content. |
Remarks
The Pivot Table component allows you to use different templates to customize appearance of its areas: headers, field values, data cells.
The DxPivotTable.FieldHeaderTemplate property specifies a common template for all field captions in the header area. The DxPivotTableField.HeaderTemplate
property overrides the common template for the current field’s header.
The following code specifies the HeaderTemplate
:
@rendermode InteractiveServer
<DxPivotTable Data="SalesData">
<Fields>
<DxPivotTableField Field="@nameof(SaleInfo.Region)"
Area="@PivotTableArea.Row"
AreaIndex="0" >
<HeaderTemplate>
<span style="color: red">@context.Text</span>
</HeaderTemplate>
</DxPivotTableField>
<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>
<DxPivotTableField Field="@nameof(Sales.SaleInfo.Amount)"
SortOrder="@PivotTableSortOrder.Ascending"
Area="@PivotTableArea.Data"
SummaryType="@PivotTableSummaryType.Sum">
</DxPivotTableField>
</Fields>
</DxPivotTable>
@code {
IEnumerable<SaleInfo> SalesData;
protected override async Task OnInitializedAsync() {
SalesData = await Sales.GetSalesAsync();
}
}
Implements
See Also