The behavior of the grid sort function is incorrect

Regarding the sort function of the grid header, if the sorting from ascending order to descending order is repeated, the displayed contents will not match between the first and second times.

first

second

@page "/grid"

<RadzenGrid AllowSorting="true" Data="foos" TItem="Foo">
    <Columns>
        <RadzenGridColumn TItem="Foo" Property="Id" Title="Id" />
        <RadzenGridColumn TItem="Foo" Property="Name" Title="name" />
    </Columns>
</RadzenGrid>


@code {
    private List<Foo> foos = new List<Foo>();
    private class Foo
    {
        public long Id { get; set; }
        public string Name { get; set; }
    }
    protected override void OnInitialized()
    {
        for (var i = 0; i < 100; i++)
        {
            foos.Add(new Foo() { Id = i + 1, Name = $"abc {i + 1}" });
        }
    }
}

Hi @no-bu ,

You can try with the RadzenDataGrid instead which seems to work as expected:

<RadzenDataGrid AllowSorting="true" Data="foos" TItem="Foo">
    <Columns>
        <RadzenDataGridColumn TItem="Foo" Property="Id" Title="Id" />
        <RadzenDataGridColumn TItem="Foo" Property="Name" Title="name" />
    </Columns>
</RadzenDataGrid>


@code {
    private List<Foo> foos = new List<Foo>();
    private class Foo
    {
        public long Id { get; set; }
        public string Name { get; set; }
    }
    protected override void OnInitialized()
    {
        for (var i = 0; i < 100; i++)
        {
            foos.Add(new Foo() { Id = i + 1, Name = $"abc {i + 1}" });
        }
    }
}

Hi @korchev

The content of the reply solved the problem.
thank you. :slightly_smiling_face:

I understand that I use "RadzenDataGrid", but is there any difference in usage between "RadzenGrid" and "RadzenDataGrid"?

Yes, there is. RadzenDataGrid is the newer one. More info available here: Introducing the brand new RadzenDataGrid

Thank you for your reply.