Skip to main content
All docs
V25.1
  • DxPivotGridField.SortOrderChanged Event

    Fires when the field’s sort order changes.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [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.

    <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