RadzenDataGrid ignores sort order when data takes long to load #623

Closed
opened 2026-01-29 17:40:24 +00:00 by claunia · 1 comment
Owner

Originally created by @CollinAlpert on GitHub (Nov 8, 2022).

Describe the bug
When specifying a default sort order (e.g. SortOrder.Descending) in a data grid column of a RadzenDataGrid, the data is not sorted accordingly if the data is loaded after the page is rendered.

To Reproduce
Consider this Blazor WASM example:

@page "/"

<RadzenDataGrid Data="People" AllowSorting="true">
    <Columns>
        <RadzenDataGridColumn Property="Name" Title="Name" TItem="Person"/>
        <RadzenDataGridColumn Property="Age" Title="Age" SortOrder="SortOrder.Descending" TItem="Person"/>
    </Columns>
</RadzenDataGrid>

@code {

    public IEnumerable<Person>? People { get; set; }

    protected override async Task OnInitializedAsync()
    {
        await Task.Delay(1_000);
        People = new[]
        {
            new Person("Steve", 21),
            new Person("Peter", 22),
            new Person("Tom", 23)
        };
    }

    public record Person(string Name, int Age);

}

Expected behavior
When the data loads, Tom is the first person in the grid.

Desktop:

  • OS: macOS
  • Browser: Firefox 106
  • Radzen version: 4.2.3

Additional context
If the data is loaded immediately, this problem does not occur.

Originally created by @CollinAlpert on GitHub (Nov 8, 2022). <!-- IMPORTANT: Read this first!!! 1. If you own a Radzen Professional or Еnterprise subscription you can report your issue or ask us a question via email at info@radzen.com. Radzen staff will reply within 24 hours (Professional) or 16 hours (Enterprise) 2. The Radzen staff guarantees a response to issues in this repo only to paid subscribers. 3. If you have a HOW TO question start a new forum thread in the Radzen Community forum: https://forum.radzen.com. Radzen staff will close issues that are HOWTO questions. 4. Please adhere to the issue template. Specify all the steps required to reproduce the issue or link a project which reproduces it easily (without requiring extra steps such as restoring a database). --> **Describe the bug** When specifying a default sort order (e.g. `SortOrder.Descending`) in a data grid column of a `RadzenDataGrid`, the data is not sorted accordingly if the data is loaded after the page is rendered. **To Reproduce** Consider this Blazor WASM example: ```razor @page "/" <RadzenDataGrid Data="People" AllowSorting="true"> <Columns> <RadzenDataGridColumn Property="Name" Title="Name" TItem="Person"/> <RadzenDataGridColumn Property="Age" Title="Age" SortOrder="SortOrder.Descending" TItem="Person"/> </Columns> </RadzenDataGrid> @code { public IEnumerable<Person>? People { get; set; } protected override async Task OnInitializedAsync() { await Task.Delay(1_000); People = new[] { new Person("Steve", 21), new Person("Peter", 22), new Person("Tom", 23) }; } public record Person(string Name, int Age); } ``` **Expected behavior** When the data loads, Tom is the first person in the grid. **Desktop:** - OS: macOS - Browser: Firefox 106 - Radzen version: 4.2.3 **Additional context** If the data is loaded immediately, this problem does not occur.
Author
Owner

@CollinAlpert commented on GitHub (Nov 9, 2022):

Thanks so much for fixing this so quickly! Is there an approximate ETA for when this fix will be released?

@CollinAlpert commented on GitHub (Nov 9, 2022): Thanks so much for fixing this so quickly! Is there an approximate ETA for when this fix will be released?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#623