mardi 22 décembre 2015

AdvancedDatagrid and itemEditor: Value disappears when clicked

I'm trying to use a ComboBox as itemEditor in an AdvancedDatagrid. Both the grid and the comboBox fills up with values. But when I click in a cell the value disappears. Have I missed a property, or do I have to write an explicit itemEditor to copy the value to and from the itemEditor?

Full code:

<?xml version="1.0"?>
<!-- dpcontrols\ArrayCollectionInAS.mxml -->
<s:Application xmlns:fx="http://ift.tt/rYUnH9" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" 
               initialize="initCB();">

<fx:Script>
    <![CDATA[
        import mx.collections.*;
        [Bindable] public var stateArray:ArrayCollection;

        public function initCB():void {
            stateArray=new ArrayCollection([{label:"AL", data:"Montgomery"},
                                      {label:"AK", data:"Juneau"},
                                      {label:"AR", data:"Little Rock"}]);
        } 

        [Bindable] public var initDG:ArrayCollection = new ArrayCollection([{etikett:'NY', tekst:"New York"}, {etikett:'LA', tekst:"Los Angeles"}]);
    ]]>
</fx:Script>     


<mx:AdvancedDataGrid id="gridIntMapping" y="24" left="10" right="605" height="166" editable="true" dataProvider="{initDG}">
    <mx:columns>
            <mx:AdvancedDataGridColumn width="130" dataField="etikett" headerText="Skjema referanse" editorDataField="text">
                <mx:itemEditor>
                    <fx:Component>                  
                        <mx:ComboBox editable="true" dataProvider="{outerDocument.stateArray}" labelField="label"/>
                    </fx:Component>
                </mx:itemEditor>
            </mx:AdvancedDataGridColumn>
    </mx:columns>
</mx:AdvancedDataGrid>

Aucun commentaire:

Enregistrer un commentaire