Format List with labelFunction property : List Label « Components « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Components » List LabelScreenshots 
Format List with labelFunction property
Format List with labelFunction property
           


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >

    <mx:Script>
        
        
            private function formatData(item:Object):String 
            {
                return dateF.format(item.data);
            }
            
            private function changeData(obj:Object):void
            {
                dateTxt.text =  dateF.format(obj.data);
            }
      
    </mx:Script>

    <mx:ArrayCollection id="myAC">
        
            <mx:Object label="{new Date(2010,1,1)}" data="{new Date(2010,1,1)}"/>
            <mx:Object label="{new Date(2010,1,2)}" data="{new Date(2010,1,2)}"/>
            <mx:Object label="{new Date(2010,1,3)}" data="{new Date(2010,1,3)}"/>
        
    </mx:ArrayCollection>       
    
    <mx:DateFormatter id="dateF" formatString="EEE, DD/MMM/YYYY" />

    <mx:TextInput id="dateTxt" editable="false"  />

    <mx:ComboBox id="myCombo" dataProvider="{myAC}"
        labelFunction="formatData"
        change="changeData(myCombo.selectedItem)" />
    
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Using labelField to tell List which column to presentUsing labelField to tell List which column to present
2.Combine label and data for List itemCombine label and data for List item
3.Using a label function with one-column List-based componentsUsing a label function with one-column List-based components
4.Using a label function to support a single-column List componentUsing a label function to support a single-column List component
5.Get selected item label from a listGet selected item label from a list
6.Drag and drop label value to a ListDrag and drop label value to a List
7.Set label field for data source of List controlSet label field for data source of List control
8.Using a function to combine the values of the label and data fields for each item for display in the List controlUsing a function to combine the values of the label and data fields for each item for display in the List control
9.Use a label function to concatenate the firstName and lastName fields of each data item for display by the controlUse a label function to concatenate the firstName and lastName fields of each data item for display by the control
w___w___w__.___j__av___a2_s___.___c__o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.