OrderBy in LoadData still not working with 5.9.5 #1585

Closed
opened 2026-01-29 17:55:43 +00:00 by claunia · 3 comments
Owner

Originally created by @osre77 on GitHub (Jan 28, 2025).

Describe the bug
I have a dataGrid with virtualization turned on and using LoadData.
When ever a sort query starts with np() or String(), IQueryable.OrderBy(string) throws an exceptin that the model type does not have the property np or String.

This started with 5.9.5 since you updated to the Linq.Dynmaic V1.6.0. 5.0.0 with the 1.6.0 preview did still work.

To Reproduce
Steps to reproduce the behavior:

  1. Get the latest comit from https://github.com/CodeYesterday/Lovi
  2. Start CodeYesterday.Lovi application
  3. Click "Open session"
  4. Select the directory LogData\SmallSession included in the repository
  5. An error notification is shown that the property np does not exist in LogItemModel.
  6. The generated OrderBy expression form the DataGrid is np(LogEvent.Timestamp) asc
  7. The same happens when a column of type string is used for sorting with the String() cast.

Expected behavior
Data should be ordered and displayed, no exception is thrown.

Desktop (please complete the following information):

  • OS: Windows 11
  • Blazor Maui Hybrid

Additional context
The np istn't even needed here, since the default sort column is never null, not sure why np is used there.

The np seems not to be a problem for filtering, only for sorting.
The DataGrid is here: 379f77071b/source/CodeYesterday.Lovi/Components/Pages/LogView.razor (L19)
The sorting is applied here: 379f77071b/source/CodeYesterday.Lovi/Session/InMemorySessionDataStorage.cs (L330)

Originally created by @osre77 on GitHub (Jan 28, 2025). **Describe the bug** I have a dataGrid with virtualization turned on and using LoadData. When ever a sort query starts with `np()` or `String()`, `IQueryable.OrderBy(string)` throws an exceptin that the model type does not have the property `np` or `String`. This started with 5.9.5 since you updated to the Linq.Dynmaic V1.6.0. 5.0.0 with the 1.6.0 preview did still work. **To Reproduce** Steps to reproduce the behavior: 1. Get the latest comit from https://github.com/CodeYesterday/Lovi 2. Start CodeYesterday.Lovi application 3. Click "Open session" 4. Select the directory `LogData\SmallSession` included in the repository 5. An error notification is shown that the property `np` does not exist in LogItemModel. 6. The generated OrderBy expression form the DataGrid is `np(LogEvent.Timestamp) asc` 7. The same happens when a column of type string is used for sorting with the `String()` cast. **Expected behavior** Data should be ordered and displayed, no exception is thrown. **Desktop (please complete the following information):** - OS: Windows 11 - Blazor Maui Hybrid **Additional context** The `np` istn't even needed here, since the default sort column is never null, not sure why np is used there. The np seems not to be a problem for filtering, only for sorting. The DataGrid is here: https://github.com/CodeYesterday/Lovi/blob/379f77071b3009ce05d11d6fe2aa72071314a6f7/source/CodeYesterday.Lovi/Components/Pages/LogView.razor#L19 The sorting is applied here: https://github.com/CodeYesterday/Lovi/blob/379f77071b3009ce05d11d6fe2aa72071314a6f7/source/CodeYesterday.Lovi/Session/InMemorySessionDataStorage.cs#L330
Author
Owner

@enchev commented on GitHub (Jan 29, 2025):

FIxed in d4113e6715

@enchev commented on GitHub (Jan 29, 2025): FIxed in https://github.com/radzenhq/radzen-blazor/commit/d4113e6715b23ce3ba8f521904b797c956fa7e77
Author
Owner

@erickarabin commented on GitHub (Jan 31, 2025):

How is this fixed? I have to add code like this below now because the np() just doesnt work anymore, now that I updated System.Linq.Dynamic.Core to 1.6.0.1.
args.OrderBy.Replace("np(", "(")

@erickarabin commented on GitHub (Jan 31, 2025): How is this fixed? I have to add code like this below now because the np() just doesnt work anymore, now that I updated System.Linq.Dynamic.Core to 1.6.0.1. args.OrderBy.Replace("np(", "(")
Author
Owner

@enchev commented on GitHub (Jan 31, 2025):

Global setting of Dynamic LINQ RestrictOrderByToPropertyOrField is set to false. Check the referenced commit.

@enchev commented on GitHub (Jan 31, 2025): Global setting of Dynamic LINQ RestrictOrderByToPropertyOrField is set to false. Check the referenced commit.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1585