Hello
We are implementing SF Grid in our application. Our backend is in C # Asp .Net Core. Due to the amount of data we chose to implement with Data, but we are having problems doing research. The return is a 400 error, as shown below. I would like to know if you know anything about this problem with the search parameter with oData.
From what we are seeing there is no support for the search parameter. Is this right? Do you know of any solution to the problem?
We are using DataManager with the ODataV4Adaptor adapter, all as it is in the documentation.
// How are we doing
getODataList (): any {
return new DataManager ({
url: 'http: // localhost / cargo',
adapter: new ODataV4Adaptor ()
});
}
// We are passing the parameters to the grid like this
this.toolbarOptions = ['Search', 'PdfExport'];
// In HTML in the <ejs-grid> component we are passing like this
<ejs-grid [toolbar] = "toolbarOptions" ...
// Bad request object received
{
"error": {
"code": "",
"message": "The query parameter 'Specified argument was out of the range of valid values. (Parameter' $ search ')' is not supported.",
"details": [],
"innererror": {
"message": "Specified argument was out of the range of valid values. (Parameter '$ search')",
"type": "System.ArgumentOutOfRangeException",
"stacktrace": "at Microsoft.AspNet.OData.EnableQueryAttribute.ValidateQuery (HttpRequest request, ODataQueryOptions queryOptions) \ r \ n at Microsoft.AspNet.OData.EnableQueryAttribute.CreateAndValidateQueryOptions (HttpRequest request, nataQueryContext). AspNet.OData.EnableQueryAttribute. <> C__DisplayClass1_0. <OnActionExecuted> b__1 (ODataQueryContext queryContext) \ r \ n at Microsoft.AspNet.OData.EnableQueryAttribute.ExecuteQuery (Object responseValue, IQueryable, DescriptionQueryActivityActivationActivationItem, Scripture Func`2 createQueryOptionFunction) \ r \ n at Microsoft.AspNet.OData.EnableQueryAttribute.OnActionExecuted (Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, IWebApiRequestMessage request, Func`2 modelFunction, Func`2 createQueryOction1, Func`2 createQueryOption1 createErrorAction) "
}
}
}
This was opened over a year ago!?!? .Net Odata v4 has never supported $search yet Syncfusion's SfGrid automatically forms the Odata query with the $search. Is Syncfusion ever going to fix this?
As a possible work around, maybe provide the ability to express which columns are filtered when someone types something into the input and then automatically transform that into a $filter?
If you're going to provide an OData4Adapter for Blazor, please make it compliant with the OData 4 implementation.
|
<SfGrid TValue="Order" AllowFiltering="true" Toolbar="@(new List<string>() { "Search" })" AllowPaging="true">
<SfDataManager @ref="dm" Url=https://services.odata.org/V4/Northwind/Northwind.svc/Orders/ Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public SfDataManager dm { get; set; }
protected override void OnAfterRender(bool firstRender)
{
base.OnAfterRender(firstRender);
RemoteOptions Rm = (dm.DataAdaptor as ODataV4Adaptor).Options;
Rm.EnableODataSearchFallback = true;
(dm.DataAdaptor as ODataV4Adaptor).Options = Rm;
}
|
Hi Vignesh, works great for my solution.
Though for others it is limited by 2048 bytes in a query string, so if you have a lot of columns it will not work with OData.
In the future, how could I limit which columns to include in the search $filter