I would like to bind all users into textbox autocomplete event. I done with below script but it is consider case sensitive expression
while searching the results.
$("#txtselectuser").autocomplete({
source: function (request, response) {
jQuery.ajax({
url: appwebUrl + "/_api/web/SiteUsers?$filter=startswith(Title,'" + request.term + "')",
method: "GET",
async: true,
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
var results = data.d.results;
response($.map(results, function (item) {
return {
label: item.Title,
val: item.Id
}
}))
},
error: function (data) {
}
});
},
select: function (e, i) {
$("#txtselectuser").val(i.item.label);
$("input#elm_inputuserid").val(i.item.val);
},
minLength: 1
});
It will returns results based on Display Title of all users. For Example : We have couple of users
1) Jignesh Rajput 2) Jigs
When I searched on Textbox with Jig
- it will return both of users but I have type on textbox with jig
(all lowercase characters) it will return 0 results
.
Here is link for showing all filter expression for REST API.
I want - will not carry case-sensitive characters and return all matches results.
I tried with tolower
functional expression however it is not working.. like :
?$filter=startswith(tolower(Title),'jig')",