Search code examples
gwtuibindergwt-bootstrap

How to set a textbox value with the selected value of Bootstrap Typeahead?


I have the following gwt-bootstrap ui.xml :

<b:Typeahead ui:field="typeahead">
   <b:TextBox ui:field="searchBox" searchQuery="true"
     placeholder="Search..." />
</b:Typeahead>

How can i programmatically take the suggested response "On Click" of the the typeahead item and set it as Text into the searchbox?


Solution

  • Well the Adarsha Answer dont really work in my case, because i use full gwt. So my Solution is :

    typeahead.setUpdaterCallback(new Typeahead.UpdaterCallback() {
    
            @Override
            public String onSelection(Suggestion selectedSuggestion) {
                String text = selectedSuggestion.getDisplayString();
                return null;
            }
        });