Skip to main content

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

DxPivotGridField.SortOrderChanged Event

Fires when the field’s sort order changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<PivotGridSortOrder> SortOrderChanged { get; set; }

#Parameters

Type Description
PivotGridSortOrder

The new SortOrder value.

#Remarks

The SortOrderChanged event allows you to react to SortOrder property value changes, for example, when a user clicks a field header.

Razor
<DxPivotGrid Data="@GridData" CssClass="w-100">
    <DxPivotGridField Field="@nameof(SaleInfo.Region)" SortOrder="@SortOrder" SortOrderChanged="OnSortOrderChanged" Area="PivotGridFieldArea.Row" />
    <DxPivotGridField Field="@nameof(SaleInfo.Country)" Area="PivotGridFieldArea.Row" />
    <DxPivotGridField Field="@nameof(SaleInfo.City)" Area="PivotGridFieldArea.Row" />
    <DxPivotGridField Field="@nameof(SaleInfo.Date)" GroupInterval="PivotGridGroupInterval.Year" Area="PivotGridFieldArea.Column" Caption="Year" />
    <DxPivotGridField Field="@nameof(SaleInfo.Date)" GroupInterval="PivotGridGroupInterval.Quarter" Area="PivotGridFieldArea.Column" Caption="Quarter">
        <HeaderTemplate>@string.Format("Q{0}", context)</HeaderTemplate>
    </DxPivotGridField>
    <DxPivotGridField Field="@nameof(SaleInfo.Amount)" Area="PivotGridFieldArea.Data" SummaryType="PivotGridSummaryType.Sum" />
    <DxPivotGridField Field="@nameof(SaleInfo.OrderId)" Caption="Count" Area="PivotGridFieldArea.Data" SummaryType="PivotGridSummaryType.Count" />
</DxPivotGrid>

@code {
    IEnumerable<SaleInfo> GridData;
    ivotGridSortOrder SortOrder = PivotGridSortOrder.Ascending;
    protected override async Task OnInitializedAsync() {
        GridData = await Sales.GetSalesAsync();
    }
    void OnSortOrderChanged(PivotGridSortOrder NewOrder) {
        SortOrder = NewOrder;
    }
}
See Also