ODataV4Adaptor adds extra single quotes to $filter

I am using SyncFusion.Blazor v19.1.0.45

I had posted this issue as part of another post related to dropdownlist defined in the <GridColumn ...> <FilterTemplate ...> not rendering on initial display but it didn't get addressed and I do not think this issue is actually part of the issue related to the control not displaying. This issue occurs after I refresh the page and the control then appears. When I try to use it to do a filter for an enum type in my ODataV4 API back end, it does not return any results. The reason is described below.   

My ODatav4 API (Microsoft ASP.NET Core 3.1 with Microsoft's ODataV4 implementation) is throwing a Status 400 from the $filter query.

The AccountType is an ENUM in the API. In Postman, I can send a GET with the following filter;

 $filter=(AccountType eq EII.CDAPI.Server.Enums.AccountTypes'Reseller')&$skip=0&$top=10

and get the expected results.

However, the output of the Grid.FilterByColumn() method wraps everything inside the parentheses in single quotes, as follows;

 $filter=('AccountType eq EII.CDAPI.Server.Enums.AccountTypes'Reseller'')&$skip=0&$top=10

Note the single quote that I have highlighted in red.

Here is the actual filter line captured in Fiddler;

/v1/accounts?$count=true&$filter=(AccountType%20eq%20'EII.CDAPI.Server.Enums.AccountTypes%27Reseller%27')&$skip=0&$top=10

Which results in a status 400 error complaining about the extra single quotes.

Here is my call to the Grid.FilterByColumn method;

                Grid.FilterByColumn("AccountType", "equal", $"EII.CDAPI.Server.Enums.AccountTypes'{args.Value}'", null, true);


Any idea how to work around this?



2 Replies

VN Vignesh Natarajan Syncfusion Team April 27, 2020 03:24 PM UTC

Hi David,  
 
Sorry for the inconvenience caused. 
 
Query: “I had posted this issue as part of another post related to dropdownlist defined in the <GridColumn ...> <FilterTemplate ...> not rendering on initial display but it didn't get addressed 
 
From your query we understand that you are facing issue while filtering the record with ENUM value and ODataV4 adaptor. It is not related to control rendering issue as reported in Forum F153564. Currently we are validating your query, we need some more time to analyze the issue further. So we will update you the further details by 29th April 2020.   
 
Till then we appreciate your patience. 
 
Regards, 
Vignesh Natarajan 



VN Vignesh Natarajan Syncfusion Team May 4, 2020 11:54 AM UTC

Hi David, 
 
Sorry for the delay in getting back to you.  
 
Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts. We have added this feature “Support to provide filtering enum values using ODataV4 adaptor” request to our database. You can now track the current status of this feature request here. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. 
 
 
 You can also communicate with us regarding the open features any time using our Feature Report page. 
 
Regards,
Vignesh Natarajan
 


Loader.
Up arrow icon