SuggestBox with KeyUp Handler-Arrow keys not working

277 views Asked by At

I have a SuggestBox with KeyUpHandler attached to it to call the service to fetch suggestions. Now, the problem is, when I type the text and suggestions are displayed, if I press down arrow key, the focus moves back to first suggestion always(due to KeyUp I guess). How can I solve this problem?

1

There are 1 answers

0
Onkar On

If you are using GWT SuggestBox , you don't need to attach a KeyUpHandler to call the service...The SuggestBox does that for you by default. Due to your adding of the keyUpHandler to call the service it is making an extra call to call the service each time you press a key and hence the behavior.

Example :

   MultiWordSuggestOracle dropItems = new MultiWordSuggestOracle();
   dropItems.add("One");
   dropItems.add("Two");
   dropItems.add("Three");
   dropItems.add("Four");

   SuggestBox box = new SuggestBox(dropItems);