Blazor SfGrid duplicate property name error when opening filter menu

I'm getting an error of "The query specified in the URI is not valid. Duplicate property named 'FieldName' is not supported in '$orderby'.", when opening a column filter menu for a column in the grid. The grid is configured for the OData adaptor, and the controller it's talking to is an OData controller. It has no problems retrieving data, paging through it, and sorting it.
However, when I open the column menu and expand the filter sub-menu, it displays the "busy" spinning circle and never returns. This only happens for columns which are part of the grid's current sort order. For other columns which are not part of the grid's sort order, it behaves properly, and the filtering behaves.

I watched the activity using Fiddler, for a column that wasn't in the grid's sort order, and found that it does two actions:
  1. It adds the column to the sort order and resubmits the query to the controller, retaining all the paging and sorting options. For example, if I open the filter menu for a field named "Field4", the query looks like this:
    /odata/TableRecords?$count=true&$orderby=Field1,Field2,Field3,Field4&$skip=0&$top=12
  2. It then submits a shorter query to the controller, requesting all the data, sorted only by the column I've asked for the filter to appear on. This query has no paging or count options on it. This is the second query, based on the above example:
    /odata/TableRecords?$count=true&$orderby=Field4
When the error occurs, it only performs the first action, and doesn't go on to do the second action because it encounters the "duplicate property" error first. For example, if I open the filter menu for Field3, which the grid is already sorted by, the query looks like this:
/odata/TableRecords?$count=true&$orderby=Field1,Field2,Field3,Field3&$skip=0&$top=12

The OData parser kicks out an HTTP 400 error because of the field appearing twice in the orderby clause sent to OData.

I realize OData is what is kicking up the error, but it's only doing so because the grid's functionality is sending an entirely unnecessary query first, before attempting to make the correct query (the second one). Can you suggest a workaround?

I'm working with v18.3.0.42 of your Blazor controls, and cannot currently upgrade into the v18.4.x version.

2 Replies 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team January 28, 2021 10:58 AM UTC

Hi Ted, 
 
Thanks for contacting Syncfusion support.   
 
Query: “'m getting an error of "The query specified in the URI is not valid. Duplicate property named 'FieldName' is not supported in '$orderby'.", when opening a column filter menu for a column in the grid. 
 
We have analyzed the reported query and we are also able to reproduce the reported issue at our end. We have confirmed it as a bug and logged the defect report “Duplicate sort query is generated when opening a excel filter for sorted column” 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 end of February, 2021. 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 
 
 
 



VN Vignesh Natarajan Syncfusion Team August 24, 2021 03:23 AM UTC

Hi Ted,

 
We are glad to announce that we have included the fix for “Duplicate sort query is generated when opening a excel filter for sorted column” issue in our 18.4.0.44 patch release. So kindly update your NuGet (Syncfusion.Blazor) to our latest version or minimum of 18.4.0.44 version  to resolve the reported issue.

 
Please find the Nuget package and release notes from below
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 

 
Regards, 
Vignesh Natarajan 


Marked as answer
Loader.
Up arrow icon