我正在使用美国各州的组合框, 链接。标签设置为州的全名,而 value 属性保存缩写。我想做的是获取所选项目的值。所以我尝试了combo.selectedItem.value和combo.selectedItem.@value,但它们都不起作用。有人可以解释一下吗?
I am using a combobox for the us states, link. The label is set to the full name of the state, while the value attribute holds the abbreviation. What I want to do is to get the selected item's value. So I tried combo.selectedItem.value and combo.selectedItem.@value, but neither of them worked. Can someone shed a light on this please?
发布评论
评论(2)
这是一个可能有帮助的简单示例。
这是另一个例子。在本例中,我们使用 XML 作为 dataProvider。
Here's a simple example that might be helpful.
Here's another example. In this one we use XML as dataProvider.
您可以使用想要获取的值填充数组,并检索组合框中所选项目的索引(应与数组中的索引相同)。
或者在您的组件中...只需在
statesUS
上查找索引(所选项目)子项You can populate an array with the values you want to get and retrieve the index of the selected item on the combo box (which should be the same as in the array).
Or in your component ... just look for the index (selected item) child on
statesUS