Hi,
I'm using row filters in Kendo-grids with "odata-v4" specified on the data-sources. I'm writing here, because I'm not sure if this is a data-source issue or a grid issue. There are two filter scenarios where errors occur on the server side (ASP.NET MVC):
1) Kendo's current implementation still uses the old "substring" instead of the OData v4 "contains" expression. The server barks.
2) Since GUIDs are handled as strings, they are wrapped in single quotation marks. The server barks.
I'm using Kendo UI version 2015.2.624.
The following hack works around those issues. It would be great if those two scenarios could be fixed in the library.
fixODataV4FilterParameterMap = function (options) {
// This is needed for Kendo-grid's filters when using OData v4.
// Call the default OData parameterMap.
var result = kendo.data.transports.odata.parameterMap(options);
if (result.$filter) {
result.$filter = result.$filter.replace(/('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')/ig, function (x) {
// Remove the single quotation marks around the GUID (OData v4).
return x.substring(1, x.length - 1);
});
// Replace "substring" with "contains" (OData v4)
result.$filter = result.$filter.replace(/substringof\((.+),(.*?)\)/, "contains($2,$1)");
}
return result;
};
Regards,
Kasimier Buchcik