MultiSort uses wrong sequence of columns

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

1 Reply 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team November 26, 2020 10:01 AM UTC

Hi Michael,  

Thanks for contacting Syncfusion support.  

Query1: “When using the AllowMultiSorting property, the order of the columns is reversed 
 
We have analyzed the reported issue and by default sort order for column will be given based on the order of sorting. For eg. If we click on ShipCountry - > CustomerName -> OrderDate. Then below will be order given to sorted columns ShipCountry -  1, CustomerName – 2 and OrderDate – 3. Hence the sort sequence was displayed correctly in Grid.  
 
But we are able to reproduce the one issue at our end that while performing multisorting in Grid. Second column must be sorted with reference to First column sorted value, but currently it is not sorting properly. We have confirmed it is a bug and logged the defect report “MultiSorting is not working in ODataAdaptor” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our weekly release which is expected to be rolled out by the end of December, 2020. We will update you once the release is rolled out.   
      
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.      
  
 
Till then we appreciate your patience.   

Regards, 
Vignesh Natarajan  


Marked as answer
Loader.
Up arrow icon