如何在 SuggestBox 中显示所有可能的值
我想在 SuggestBox 中显示所有可能的值。
当然,我有以下代码(settingName 是一个SuggestBox)
settingName.getTextBox().addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
settingName.showSuggestionList();
}
});
不幸的是,建议框显示任何内容。当然,settingName 与一个预言机相关联,其中包含多个值。
我疯了吗?
根据文档:
公共无效showSuggestionList()
显示当前的建议列表。
I would like to display all possible values in a SuggestBox.
Naturally, I have the following code (settingName is a SuggestBox)
settingName.getTextBox().addFocusHandler(new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
settingName.showSuggestionList();
}
});
Unfortunately, the suggestbox displays anything. Of course, the settingName is associated to an oracle with several values inside it.
Am I crazy ?
According to the documentation :
public void showSuggestionList()
Show the current list of suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将默认值设置为
suggestOracle.setDefaultSuggestionsFromText(..)
You need to set the defaults to show by
suggestOracle.setDefaultSuggestionsFromText(..)
显示列表时,
SuggestBox
将向预言机询问要显示的值。如果文本框为空,则将调用requestDefaultSuggestions
(默认情况下调用requestSuggestions
)。When showing the list, the
SuggestBox
will ask the oracle for values to show. If the text box is empty, thenrequestDefaultSuggestions
will be called (which by default callsrequestSuggestions
).