我正在使用 typeahead 进行自动完成。以下代码工作正常。
var employees = new Bloodhound({
datumTokenizer: function (d) { return Bloodhound.tokenizers.whitespace(d.name); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
addOnBlur: true,
remote: {
url: $url + '?name=%QUERY',
global: false,
wildcard: '%QUERY',
filter: function (response) {
return $.map(response.results, function (employee) {
return {
mark: employee.MARK,
actitle: employee.ACCOUNTTITLE,
code: employee.CODE
}
});
}
}
});
employees.initialize();
$($classname).typeahead({ highlight: true, minLength: 1, limit: 5 }, {
name: 'employees', displayKey: 'mark', source: employees.ttAdapter(), global: false
})
.on("typeahead:selected", function (obj, company1) {
//debugger;
$($retField).val(company1.actitle);
$($cField).val(company1.code);
})
.on('focusout', function (obj, company) {
//debugger;
$($classname).trigger("typeahead:first-child");
});
}
我想将 ajax 全局事件设置为 false。请帮我解决问题