我有以下gwt-bootstrap ui.xml:
<b:Typeahead ui:field="typeahead">
<b:TextBox ui:field="searchBox" searchQuery="true"
placeholder="Search..." />
</b:Typeahead>
如何以编程方式获取typeahead项目的“On Click”建议响应并将其设置为Text到搜索框中?
答案 0 :(得分:2)
Adarsha答案确实不适用于我的情况,因为我使用的是完整的gwt。所以我的解决方案是:
typeahead.setUpdaterCallback(new Typeahead.UpdaterCallback() {
@Override
public String onSelection(Suggestion selectedSuggestion) {
String text = selectedSuggestion.getDisplayString();
return null;
}
});
答案 1 :(得分:0)
以下链接肯定会帮助您 -
Get selected items value for Bootstrap's typeahead
一旦获得所选值,只需执行textbox.setValue(value)。