Using JQuery AutoComplete UI ,1.8, I need to change the search so it matches only at the start of the string. Background my source comes from an ajax call that I don't control that returns 15,000 and their corresponding PKs. value is the name and Id is the integer PK.The code below works but since I'm searching through 15,00 strings that matches any where in the string it is too slow. I've seen this post, link, but I couldn't figure out how to do without losing the Id field in the source.
I need the search to only match the beginning of value in data.d without losing the Id field. This is an ASP.Net app but I don't think it matters. Ideas?
$("#companyList").autocomplete({
minLength: 4,
source: data.d,
focus: function(event, ui) {
$('#companyList').val(ui.item.value);
return false;
},
select: function(event, ui) {
$('#companyList').val(ui.item.value);
$('#<%= hdnCompanyListSelectedValue.ClientID %>').val(ui.item.Id);
return false;
}
});