3 Replies Latest reply on Sep 18, 2012 3:37 PM by BrianJ011980

    comboBox datafield?

    max.soft

      Hi all,

      I would like show on a comboBox value pairs of key and description of a database table.

      how to specify the dataField? I see only the labelField.

      thank you

        • 1. Re: comboBox datafield?
          ATIF FAROOQ Level 3

          hi,

             will u please describe your problem more clearly that what you trying to do ?

          • 2. Re: comboBox datafield?
            Michael Borbor Level 4

            Use a labelFunction

             

            <mx:Script>
                      <![CDATA[
            
                           import mx.collections.ArrayCollection;
            
                           [Bindable]
                           private var medalsAC:ArrayCollection = new ArrayCollection( [
                                { Country: "USA a very long country name", Gold: 35, Silver:39, Bronze: 29 },
                                { Country: "China", Gold: 32, Silver:17, Bronze: 14 },
                                { Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);
            
                           private function myLabelFunction(obj:Object):String{
                                return obj.Country + " " + obj.Gold;
                           }
                      ]]>
                 </mx:Script>
                 <mx:ComboBox dataProvider="{medalsAC}" labelFunction="myLabelFunction" />
            
            • 3. Re: comboBox datafield?
              BrianJ011980

              Hey max soft, I get what you mean and i need something similar - a datafield which will pass the if of the label, so that I can update a database. How did you solve this?

               

              Any help would be much apprecited.

               

              Thanks,

              Brian