I'm using jQueryUI AutoComplete but am having a small problem in that no filtering is taking place as the user types in the text box.
Basically what happens is that after I've typed 3 characters the auto-fill drop down fills with the entire collection of items returned from the server but the choice does not narrow down as more characters are typed.
Any ideas as to why this is happening?
Client:
$("#Make").autocomplete({
minLength: 3,
source: function (request, response) {
$.ajax({
type: "POST",
url: '@Url.Action("LookupGadgets", "Quote")',
dataType: "json",
data: {
type: $("#Type").val()
},
success: function (data) {
response($.map(data, function (c) {
return {
label: c.Details,
value: c.Details
}
}));
}
});
}
});
Server:
public ActionResult LookupGadgets(string type)
{
var retValue = gadgetsRepository.AvailableGadgets
.Where(x => x.Type == type)
.OrderBy(x => x.Make)
.Select(r => new { Details = r.Make + " " + r.Model });
return Json(retValue);
}