Open tmaier opened 1 year ago
Yes, we need this method. It seems it doesn't even let me trigger showing the results with a .trigger("change") or keyup or whatever ...
Update:
I added a single line of code to the autocomplete.js file to allow external (programmatic) triggering of the search.
Add this to the connect() function in autocomplete.js:
document.addEventListener("doSearch", this.onInputChange);
Then, in your website/app, you can trigger this event manually by doing:
const event = new Event("doSearch");
document.dispatchEvent(event);
For example, if you want to trigger the search using a button press, in jQuery you could do:
$('#yourButton').click(function(e){
const event = new Event("doSearch");
document.dispatchEvent(event);
});
And voila, pressing the button with id="yourButton" will trigger the search.
It's a bit hacky, but I'm not a javascript expert.
Suppose you have such a combobox:
When one closes the combobox, one should be able to re-open it by clicking on the button (to the right).
Please add a
toggleResults
orshowResults
method, one could bind to the button.