GWT Suggestbox 在实例化后定义建议预言机
我在 UIBinder 中定义了一个 suggestbox,我需要动态设置它的 SuggestOracle。我见过的所有示例都表明您只能在实例化时定义 suggestoracle,但我需要在事后定义它。有办法做到这一点吗?
谢谢!
I've defined a suggestbox in UIBinder, and I need to dynamically set its SuggestOracle. All the examples I've seen show that you can only define the suggestoracle at instantiation, but I need to define this AFTER the fact. Is there a way to do this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
SuggestBox
中的方法getSuggestOracle
获取预言机。默认情况下,它来自MultiWordSuggestOracle
类型。然后,只需添加您想要的单词:Use the method
getSuggestOracle
atSuggestBox
to get the oracle. By default, it's from typeMultiWordSuggestOracle
. Then, just add the words you want:正如 italo 所说,使用 getSuggestOracle() 获取 SuggestOracle 实例,然后您可以执行 orcl.clear() 来清除所有内容,最后使用 addAll()。
您还可以查看此示例,该示例显示了一个 SuggestBox(型号),该 SuggestBox 取决于另一个主要 SuggestBox(汽车品牌)上的所选值。
http://siempredesdeelcurro.blogspot.com .es/2013/05/simplest-example-of-gwt-with-eclipse.html
As italo said, get the instance of SuggestOracle with getSuggestOracle(), then you can do a orcl.clear() to clean all the contents and finally addAll().
You can also check out this example that shows a SuggestBox (models) that depends on the selected value on another main SuggestBox (car brands).
http://siempredesdeelcurro.blogspot.com.es/2013/05/simplest-example-of-gwt-with-eclipse.html