3 Replies Latest reply on Apr 27, 2010 6:36 AM by ptamilar

    Spark Combobox with empty dataprovider

    ptamilar Level 1

      There seems to be a bug when using a spark combobox with an empty dataprovider.  The idea is to have an empty combobox that adds all entries into the dataprovider for each one entered.  Attached is a simple project to demonstrate this.  The first combobox has a dataprovider with the colors "Red", "Green", "Blue" in it.  Typing anything in the box, whether it is an existing item or a new one, will display it in the label below.

       

      The second combobox has a dataprovider that is currently empty.  Typing anything into the box and hitting enter does absolutely nothing.  There is no way to get the value entered into the combobox now.

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
            xmlns:s="library://ns.adobe.com/flex/spark" 
            xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
       <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
       </fx:Declarations>
       <s:Panel x="10" y="10" width="250" height="200" title="Combobox with dataprovider">
        <s:ComboBox x="10" y="10" width="228" id="cbFull">
         <s:dataProvider>
          <s:ArrayCollection>
           <fx:String>Red</fx:String>
           <fx:String>Green</fx:String>
           <fx:String>Blue</fx:String>
          </s:ArrayCollection>
         </s:dataProvider>
        </s:ComboBox>
        <s:Label x="7" y="37" text="Selected Item: "/>
        <s:Label x="94" y="37" text="{cbFull.selectedItem}"/>
       </s:Panel>
       <s:Panel x="268" y="10" width="250" height="200" title="Combobox with empty dataprovider">
        <s:ComboBox x="10" y="10" width="228" id="cbEmpty">
         <s:dataProvider>
          <s:ArrayCollection/>
         </s:dataProvider>
        </s:ComboBox>
        <s:Label x="15" y="41" text="Selected Item: "/>
        <s:Label x="102" y="41" text="{cbEmpty.selectedItem}"/>
       </s:Panel>
      </s:Application>