6 Replies Latest reply on Sep 10, 2010 3:59 AM by Flex4Education

    Problems with ComboBox-Data in a DataGrid

    Flex4Education Level 1

      Hi there!

       

      I've got a ComboBox in my DataGrid, using the following code:

          

      <mx:DataGridColumn

      dataField="id_formation_mark"

      editable="true"

      editorDataField="selectedItem"

      itemEditor="{array_XY}"/>

       

      <mx:Component id="array_XY">
           <mx:ComboBox>
                <mx:dataProvider>
                     <mx:String>A</mx:String>
                     <mx:String>B</mx:String>
                </mx:dataProvider>
           </mx:ComboBox>

      </mx:Component>

       

      There is now a new column in the DataGrid, named "name_XY" with a usable ComboBox in it. Now all the data in "array_XY" can be accessed. I can select an item and it will be displayed immediatly in the DataGrid. However if I use an new dataprovider, e.g. an ArrayCollection "arraycollectiom_XY", there will appear a [object Object] in the DataGrid, after having selected something in the ComboBox, instead of the correct value.

       

      This is the code of my example:

       

      <mx:DataGridColumn

      dataField="id_formation_mark"

      editable="true"

      editorDataField="selectedItem"

      itemEditor="{arraycollection_XY}"/>

       

      <mx:Component id="arraycollection_XY">

           <mx:ComboBox

                dataProvider="{outerDocument._arraycollection_XY}"

                labelField="description">

           </mx:ComboBox>

      </mx:Component>

       

      I think the problem is kinda like the one with a standard ComboBox, when using an ArrayCollection as dataprovider. Here you can fix this with the attribute "lableField". Is there any way to display the selected data of the ArrayCollection from the ComboBox in the DataGrid, without the [object Object].

       

      Thanks in advance!

      Flex4Education