我在 Flex 中遇到了一个大问题......
其实我的要求是我有两个组合框Country和State
当我们选择国家时,根据州将改变..
例如,我们选择 Country 作为India然后 State 组合框给出印度的所有州。
他们是否有任何免费组件帮助我....
非常感谢提前....
我在 Flex 中遇到了一个大问题......
其实我的要求是我有两个组合框Country和State
当我们选择国家时,根据州将改变..
例如,我们选择 Country 作为India然后 State 组合框给出印度的所有州。
他们是否有任何免费组件帮助我....
非常感谢提前....
创建两个组合框相当简单。您可以只使用一个数据提供者,并将一个组合框中的selectedItem属性用作第二个组合框的数据提供者。
问题可能是找到所有国家和州的列表。
这个小例子实现了我的解决方案。
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
]]>
</fx:Script>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var stateCountr:ArrayCollection =new ArrayCollection( [
{name:"United States",states:new ArrayCollection(["Illinois","California","Arkansas","Florida","Alabama","New Jersey"])},
{name:"India",states:new ArrayCollection(["Punja","Uttar Pradesh","Kerala"])},
{name:"EU",states:new ArrayCollection(["Italy","France","Germany"])}
]);
]]>
</fx:Script>
<mx:VBox>
<s:DropDownList id="country" labelField="name" dataProvider="{stateCountr}" >
</s:DropDownList>
<s:DropDownList id="state" dataProvider="{country.selectedItem.states}">
</s:DropDownList>
</mx:VBox>
</s:Application>
您还应该看看这个ComboBox State and Country