I did try server side filtering using angular 2 kendo grid with odata v4 but it showing 'contains' keyword not supporting. new version using 'substringof' instead of 'contains' how can i solve this issue
I did try server side filtering using angular 2 kendo grid with odata v4 but it showing 'contains' keyword not supporting. new version using 'substringof' instead of 'contains' how can i solve this issue
Install Odata V4 and configure WebApiConfig.cs
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
var customer = builder.EntitySet<CustomerModel>("CustomerSearch");
config.Routes.MapODataServiceRoute(
routeName: "odata",
routePrefix: "odata",
model: builder.GetEdmModel());
'CustomerModel' is my model to return "CustomerSearch" controller name
Odata Controller
[EnableQuery]
public class CustomerSearchController : ODataController
{
[EnableQuery]
public IQueryable<CustomerModel> Get()
{
CustomerModelResponse list = new CustomerModelResponse();
try
{
list = CustomerBL.GetCustomer(0);
}
catch (Exception)
{
throw;
}
return list.CustomerList.AsQueryable();
}
}
We use OData v3.
What I did is i regex the queryString if it has a contains() and then replace it with substringof()
Here is an example:
let queryString = toODataString(state);
const regex = /(contains(([^)]+)\)))/;
queryString = _.replace(queryString, regex, `substringof('${filter.value}', ${filter.field})`);
I'm using lodash here but i should also work with the string.replace function