Set a labelFunction for a Control : ComboBox « Components « Flex






Set a labelFunction for a Control

Set a labelFunction for a Control
           
   

<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="horizontal">

    <mx:ComboBox dataProvider="{myDP}" labelFunction="getFullName"/>

    <mx:Script>
        
            import mx.collections.ArrayCollection;

            [Bindable]
            private var myDP:ArrayCollection = new ArrayCollection([{id:1,fName:"A", lName:"C"},
                                                                   {id:2, fName:"B", lName:"D"}]);

            private function getFullName(item:Object):String{
                return item.fName + " " + item.lName;
            }

      
    </mx:Script>
</mx:Application>
    
    

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.ComboBox open/close easing functionComboBox open/close easing function
2.Create ComboBox with static objectsCreate ComboBox with static objects
3.Populating a ComboBox control using variablesPopulating a ComboBox control using variables
4.ComboBox-based custom componentComboBox-based custom component
5.extends the standard ComboBox control to initialize itextends the standard ComboBox control to initialize it
6.Sort ComboBox
7.Insert value to ComboBox through CursorInsert value to ComboBox through Cursor
8.Set row count for ComboBoxSet row count for ComboBox
9.Use labelFunction to provide label text for ComboBoxUse labelFunction to provide label text for ComboBox
10.Bind Image source to ComboBox
11.Pass in parameter from ComboBox to WebServicePass in parameter from ComboBox to WebService
12.Editable ComboBoxEditable ComboBox
13.Bind ComboBox and TextInput and TextBind ComboBox and TextInput and Text
14.Static ComboBoxStatic ComboBox
15.ComboBox with static String valuesComboBox with static String values
16.Simple ComboBoxSimple ComboBox
17.ComboBox component supports a closeEasingFunction style property.ComboBox component supports a closeEasingFunction style property.
18.Uses the bound propertyUses the bound property