Hi,
When using the AllowMultiSorting property, the order of the columns is reversed.
Please find the code below.
------
@page "/GridSorting"
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Grids
@using Syncfusion.Blazor.Data
@using Syncfusion.Blazor.Buttons
<div class="col-lg-12 control-section">
<div class="content-wrapper">
<div class="row">
<SfGrid @ref="grid"
TValue="Orders"
ID="id-for-table" AllowSorting="true" AllowMultiSorting="true" AllowFiltering="true">
<GridPageSettings PageSize="12" />
<SfDataManager @ref="dataManager"
Url="https://js.syncfusion.com/demos/ejservices/Wcf/Northwind.svc/Orders"
CrossDomain="true"
Adaptor="Adaptors.ODataAdaptor">
</SfDataManager>
<GridColumns>
<GridColumn Field="@nameof(Orders.OrderID)" HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field="@nameof(Orders.CustomerID)" HeaderText="Customer Name" Width="150"></GridColumn>
<GridColumn Field="@nameof(Orders.OrderDate)" HeaderText="Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field="@nameof(Orders.Freight)" HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field="@nameof(Orders.ShipCountry)" HeaderText="Ship Country" Width="150"></GridColumn>
</GridColumns>
<GridFilterSettings Mode="@FilterBarMode.OnEnter" ShowFilterBarStatus="false" Type="@Syncfusion.Blazor.Grids.FilterType.FilterBar">
<GridFilterColumns>
<GridFilterColumn Field="@nameof(Orders.Freight)" Operator="@Operator.LessThan" Value="10" Predicate="and" />
</GridFilterColumns>
</GridFilterSettings>
<GridSortSettings>
<GridSortColumns>
<GridSortColumn Field="@nameof(Orders.ShipCountry)" Direction="SortDirection.Descending"></GridSortColumn>
<GridSortColumn Field="@nameof(Orders.OrderDate)" Direction="SortDirection.Descending"></GridSortColumn>
</GridSortColumns>
</GridSortSettings>
</SfGrid>
</div>
</div>
</div>
<SfButton OnClick="SortGrid">Sort Grid</SfButton>
@code {
private SfGrid<Orders> grid;
private SfDataManager dataManager;
private void SortGrid()
{
}
class Orders
{
public int OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime OrderDate { get; set; }
public Decimal Freight { get; set; }
public string ShipCountry { get; set; }
}
}
------
I would have expected, according to documentation, that first it would be sorted by Ship Country DESC, and then by Customer Name DESC. Looking at the data in the grid, it is first sorted by Order Date DESC and then by Ship Country DESC.
Also when doing this manually, I get the same result. First I clicked Ship Country, then Customer Name and finally Order Date.
As you can see, the order of sorted fields is reversed.
Expected result (achieved by sorting in reverse order):
Best regards,
Michael Brignola