La función de captación previa de Bloodhound funciona muy bien para mí, pero me gustaría desactivar mis entradas mientras se realiza la captación previa.
¿Alguien sabe de alguna forma de detectar cuándo está ocurriendo la captación previa, hacer algo y luego hacer otra cosa cuando se completa la captación previa? Aquí está mi código.
// Nav typeahead var costCenters = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('bloodhound'), queryTokenizer: Bloodhound.tokenizers.whitespace, prefetch: dsg_site_root + 'autocomplete/costCenterPullDownNamesComplete' }) var employees = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('bloodhound'), queryTokenizer: Bloodhound.tokenizers.whitespace, prefetch: dsg_site_root + 'autocomplete/employeePullDownNamesComplete' }) $(function() { $('#navSearch').typeahead({ highlight: true, maxItem: 20, }, { name: 'costCenters', display: 'display', source: costCenters, templates: { header: '<h6 class="ml-3 mt-2 text-secondary">Cost Centers</h6>' } }, { name: 'employees', display: 'display', source: employees, templates: { header: '<h6 class="ml-3 mt-2 text-secondary">Employees</h6>' } }) $('#navSearch').bind('typeahead:select', function(ev, chosen) { if(chosen.category == 'employees') { window.location.href = dsg_site_root + 'employee/index/' + chosen.id } else { window.location.href = dsg_site_root + 'costCenter/index/' + chosen.id } }) })Gracias por adelantado.