5 Replies Latest reply on Aug 30, 2010 2:34 PM by sd_brown

    Spark ComboBox in mx control -> Disappearing DropDown Menu

    schnorro

      Hey Everyone!

      I have a problem displaying a spark combobox as an item editor in an mx data grid. Since I've been trying to figure it out for some time without any luck I thought one of you guys might have a hint for me.

      The situation:

       

      One of my columns is supposed to provide a Spark ComboBox to edit the entries:

      <mx:DataGridColumn headerText="Names"

            dataField="Name"

            itemEditor="myComboBoxRenderer"

           />

       

      It uses the custom component "myComboBoxRenderer" which basically contains a spark combobox.

      <?xml version="1.0"?>
      <s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                creationComplete="init()">
         
          <fx:Script>
              <![CDATA[
                  import mx.collections.ArrayCollection;
                 
                  [Bindable]public var selectableValues:ArrayCollection = new ArrayCollection(
                      [
                           "a",
                           "b", 
                           "c", 
                           "d", 
                           "e"
                      ] );
                 

                  public function init():void{
                      legalValueSparkComboBox.dataProvider = selectableValues;
                  }
                 
                             
                  private var _updatedValue:String;
                  private var _columnName:String;
                 
                  public function get updatedValue():String
                  {
                      return mySparkComboBox.textInput.text;
                  }
                 
                  public function set updatedValue(value:String):void
                  {
                      _updatedValue = value;
                  }
                 
                  override public function set data(value:Object):void
                  {
                      if (value != null) {
                          mySparkComboBox.textInput.text = value.Name;
                      }
                  }
            
                 
              ]]>
          </fx:Script>
         
          <s:ComboBox id="mySparkComboBox" width="100%" />
         
      </s:MXDataGridItemRenderer>