根据this answer您可以覆盖搜索功能和适用所有的过滤器。
你的情况:
var source = [
{"value": "JL", "name": "JL", "group": "Test"},
{"value": "MV", "name": "MV", "group": "Family"}
];
$('#ContactPerson').autocomplete({
source: source,
search: function (oEvent, oUi) {
// get current input value
var sValue = $(oEvent.target).val();
//groupValue
var groupValue = $("#group").val();
// init new search array
var aSearch = [];
// for each element in the source array ...
$(source).each(function (iIndex, sElement) {
var groupFilterMatch = ((groupValue && sElement.group.indexOf(groupValue) != -1) || !groupValue);
var nameFilterMatch = sElement.name.indexOf(sValue) != -1;
// ... APPLY YOUR FILTERS HERE
//Example: filter group, if it is defined, and filter name
if (groupFilterMatch && nameFilterMatch) {
// add element
aSearch.push(sElement);
}
});
// change search array
$(this).autocomplete('option', 'source', aSearch);
}
});
http://jsfiddle.net/vcarvalho/91Lj5nxx/
[http://stackoverflow.com/questions/7734554/how-to-filter-your-jquery-autocomplete-data-while-typing#回答#7736994](http://stackoverflow.com/questions/7734554/how-to-filter-your-jquery-autocomplete-data-while-typing#answer-7736994) – Victor 2014-09-23 14:15:57
我试图适应这个解决方案,我的问题,这是我尝试http://jsfiddle.net/71puvk59/当在第一个字段中输入测试时,只有1条记录可以显示在自动完成列表中。 – user3253002 2014-09-23 15:25:25