Styling columns : DataGrid Style « Grid « Flex






Styling columns

Styling columns
         

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.collections.ArrayCollection;
        import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
        [Bindable]
        private var dpADG:ArrayCollection = new ArrayCollection([
                {Artist:'A', Album:'aa', Price:11.99},
                {Artist:'B', Album:'bb', Price:11.99},
                {Artist:'J', Album:'jj', Price:12.99},
                {Artist:'K', Album:'kk', Price:10.99}
        ]);
        public function myColStyleFunc(data:Object,col:AdvancedDataGridColumn):Object
        {
            if(data["Price"] <= 11.00)
                return {color:0x00FF00};
            return null;
        }
      
    </mx:Script>
    <mx:AdvancedDataGrid id="myADG" width="100%" height="100%" dataProvider="{dpADG}">
        <mx:columns>
            <mx:AdvancedDataGridColumn dataField="Artist" />
            <mx:AdvancedDataGridColumn dataField="Album" />
            <mx:AdvancedDataGridColumn dataField="Price" styleFunction="myColStyleFunc" />
        </mx:columns>
    </mx:AdvancedDataGrid>

</mx:Application>

   
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Get selected column index and row indexGet selected column index and row index
2.Styling rowsStyling rows