智能GWT如何选择ComboBoxItem中的项目
我的问题看起来应该是一个非常简单的问题,但不知怎的,事实并非如此。 SmartGwt 有一种让事情变得简单却变得过于复杂的方法!
我有一个由 LinkedHashMap 填充的 ComboBoxItem。我想要做的就是能够以编程方式选择要显示的行/值。在普通的 GWT 中,这将类似于:
listBox.setSelected(1)
我已经搜索了又搜索,但结果是空的。请有人帮忙!!!
I have what seems like it should be a really simple problem, but somehow it is not. SmartGwt has a way of taking something easy and making it overly complicated!
I have a ComboBoxItem populated by a LinkedHashMap. All I want to do is to be able to programmatically select a row/value to display. In plain GWT, this would be something like:
listBox.setSelected(1)
I have searched and searched, and I have come up empty. Please someone help!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您的地图具有
“Then”之类的值
Suppose your map has values like
Then
您可以通过 setValuMap(String array[]) 设置 Combobox 项中下拉菜单的值
String []valueMap = {"A","B"};
comboBoxItem.setValueMap(valueMap);
这会将字符串数组中的值设置为组合框。您可以通过 setValue(String value) 函数以编程方式设置值。
comboBoxItem.setValue("A");
http://www.smartclient.com /smartgwt/javadoc/com/smartgwt/client/widgets/form/fields/ComboBoxItem.html
You Can set value's for drop down in Combobox item through setValuMap(String array[])
String []valueMap = {"A","B"};
comboBoxItem.setValueMap(valueMap);
this will set the value in string array to combox box. You can set value programmatically through setValue(String value) function.
comboBoxItem.setValue("A");
http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/form/fields/ComboBoxItem.html