views:

22

answers:

1

Hallo

Hope one of you can perhaps help me. I have a data grid with an Combobox itemRenderer in it. What I have is a grid with a person id and person name (more stuff in grid but I am struggling with this). In the person name column I have an combobox with all the people on then system's names and id's. What I want to do is when I select a person in the combobox I want the combobox to populate the person name fields (which it does) but I also want to pull out the person id from the combobox and populate the person id column in the data grid as well. If anyone can please help me with this I will be very great full.

Kind Regards Monica

A: 

You can assign value to the data object for item in ComboBox change event. Something like this

<mx:DataGridColumn dataField="name" rendererIsEditor="true">
  <mx:itemRenderer>
    <mx:Component>
      <mx:ComboBox  text="{data.name}" dataProvider="{outerDocument.namesList}" 
                    change="{data.id = this.selectedIndex}"  />         
    </mx:Component>
  </mx:itemRenderer>
</mx:DataGridColumn>

You can acquire the value of ID the way you want and this should give you the idea of how to do it.

HTH

Faheem