Reputation: 21
I am trying to filter a data set with a searchField, but when building the filter, there is no documented way to filter case-insensitive. Could you help me?
This is how I build my filter:
var oFilter = new sap.ui.model.Filter("name", sap.ui.model.FilterOperator.Contains, sQuery);
Upvotes: 1
Views: 5179
Reputation: 135
you can use the OData tolower() function to compare to lower-case strings.
var oFilter = new Filter("tolower(name)",
FilterOperator.Contains,"'" + sQuery.toLowerCase().replace("'","''") + "'");
sap.ui.model.Filter and sap.ui.model.FilterOperator must be referenced.
Case insensitive filter explained
Upvotes: 2