Angular 2 Kendo grid not supporting odata v4
2 answers
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 Controller name CustomerSearch
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();
}
}
0
source to share
We are using OData v3.
What I did was regex queryString if it has contains () then replace it with substringof ()
Here's an example:
let queryString = toODataString(state);
const regex = /(contains(([^)]+)\)))/;
queryString = _.replace(queryString, regex, `substringof('${filter.value}', ${filter.field})`);
I am using lodash here but I also have to work with string.replace function
0
source to share