根據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