我想在flex中将组合框中的选项添加到数据网格中

时间:2014-02-06 07:41:59

标签: actionscript-3 flex flex4

<mx:FormItem label="Blood:"  width="100%" >
    <s:ComboBox id="blood" prompt="Blood Group" >
        <s:dataProvider>
        <mx:ArrayList>
            <fx:String>B+ve</fx:String>
        <fx:String>A+ve</fx:String>
            <fx:String>O+ve</fx:String>
        <fx:String>O-ve</fx:String>
        <fx:String>A-ve</fx:String>
        <fx:String>B-ve</fx:String>
        </mx:ArrayList>
     </s:dataProvider>
    </s:ComboBox>
</mx:FormItem>

这是我的代码。我想将血型值添加到数据网格中。

1 个答案:

答案 0 :(得分:0)

 public function adddetails():void{
if(txtname.text !=""&&txtdob.text != "")//)&&( txtEmpname !="" )&&( txtEmpphone !="")
            {
ac.addItem({Name:txtname.text, DOB:txtdob.text,
                                                                           Standard:txtstd.value,Gender:txtg.selectedItem,Blood:Bloodtype});
                //Alert.show("Form Submitted!");
                clearInputs();
}

}


<s:VGroup gap="2">
    <mx:FormItem label="Gender" width="200" required="true">
    <s:ComboBox id="txtg" width="100%" prompt="Select Gender"> 
            <s:dataProvider>
            <mx:ArrayList>
                                                          <fx:String>Male</fx:String>
                                                           <fx:String>Female</fx:String>

        </mx:ArrayList>
            </s:dataProvider>
        </s:ComboBox>
        </mx:FormItem>
    <s:Label text="The selected item is: {txtg.selectedItem}"/>
    </s:VGroup>