autocomplete icon indicating copy to clipboard operation
autocomplete copied to clipboard

Trigger update

Open ftomassetti opened this issue 6 years ago • 4 comments

Is there a way to trigger the update programmatically?

ftomassetti avatar Apr 09 '20 09:04 ftomassetti

@kraaden would be nice to have this feature implemented

hyyan avatar Jun 05 '20 11:06 hyyan

Hello @kraaden

yes, it would be nice to have a method to fetch suggestions programmatically

Something like the jquery UI "search" -> https://api.jqueryui.com/autocomplete/#method-search

Thank you in advance

PS: showOnFocus is helpful but not the exact solution :+1:

pontikis avatar Dec 19 '20 16:12 pontikis

@kraaden Great package many thanks for your time. I would agree an improvement would be to trigger the update programmatically, as I cannot find a way for right click + paste to be detected by the showOnFocus, even using the focus() native javascript command. The user has to manually type to invoke the fetch/update after right click and paste.

StuartCreed avatar Jun 02 '21 12:06 StuartCreed

As a temporal hack this works for me at the moment

  setTimeout(() => {
    inputElement.dispatchEvent(new KeyboardEvent('keyup'));
  }, 200);

This is in an Electronjs app, so I'm not concerned about browser compatibility. (I have an extra checkbox that changes the fetch, that's why I want to trigger the update)

eeemarv avatar Dec 13 '21 13:12 eeemarv

@StuartCreed Now the autocomplete should display suggestions even if you insert text by mouse+right click (in the version 8).

denis-taran avatar Feb 08 '23 05:02 denis-taran

In the latest version you can manually trigger updates like this:

const result = autocomplete({...});
result.fetch();

denis-taran avatar Feb 14 '23 09:02 denis-taran