views:

13

answers:

1

I have combo-box;

<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx" >
    <fx:Script>
        <![CDATA[
            public var cbSelected:String;    
        ]]>
    </fx:Script>
        <mx:ComboBox id="CustomBox" updateComplete="cbSelected=CustomBox.selectedLabel;" dataProvider="{parentDocument.getAllResult4.lastResult}"  labelField="name"/>  
</mx:VBox>

And I display the combo-box in a data-grid. My problem is that I need a key to be send back. My table is as below:

KEY | NAME
ON | ONE
TW | TWO

So I display the name in combobox by using

labelField="name"

But how to have the return value of key? so ONE is displayed in the combo-box and ON is returned back.

+2  A: 

Solved by adding:

cbSelected=CustomBox.selectedItem.KEY
Adnan