on 2016 Jun 03 1:37 PM
Hi Experts ,
I have a search field and List in my master page . When I am searching the list Items by typing in the search field it is working only when i enter correct case . For eg : If my list item is Rizwan , In order to search I have to type Rizwan(R beign caps ) then only its working . If I type rizwan(r being small )its not working . Is there any way to remove this case sensitivity so that it should work with either case (upper and lower ) just like in Explored search functionality .
Please help with the code if possible .
Thanks
Rizwan
Request clarification before answering.
Hi Rizwan,
Basically it depends on your model which you are using. As far as I know JSONModel can be filter case-insensitive but for oData it´s different. For oData it depends on the backend how filter is handled.
Please refer e.g. to this thread: https://scn.sap.com/thread/3511904
As a workaround, if backend is not changeable you may build several search strings in JavaScript to hit the 95% case (assuming sQuery is a String object):
var sQueryLower = sQuery.toLowerCase();
var sQueryUpper = sQuery.toUpperCase();
var sQueryUpLow = sQuery[0].toUpperCase() + sQuery.substr(1).toLowerCase();
aFilter.push(new Filter("ProductID", FilterOperator.Contains, sQueryLower));
aFilter.push(new Filter("ProductID", FilterOperator.Contains, sQueryUpper));
aFilter.push(new Filter("ProductID", FilterOperator.Contains, sQueryUpLow));
This is certainly not perfect but better then nothing if you can´t change the backend.
Best regards,
Sebastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.