Flex Advanced Datagrid Condition Row Background Color

前端 未结 1 1551
醉话见心
醉话见心 2021-01-14 06:35

I am trying to set the row background color for the advanced data grid control in Flex 3. Does anyone know if this is possible using a style function. Currently my style fun

相关标签:
1条回答
  • 2021-01-14 07:28

    I have done some thing like that but in my case color was also coming from data also but it will help you. You have to override the Datagrid and override drawRowBackground method

    public class CustomDataGrid extends AdvancedDataGrid
        {   
    
            protected override function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void{
                  var XMLdata:XML=rowNumberToData(dataIndex) as XML;               
                  if(XMLdata!=null){          
                            if(XMLdata.attribute(Constants.col) != undefined && XMLdata.attribute(Constants.col) != ""){
                                color=XMLdata.attribute(Constants.col);         
                            }else{
                                color=0xFFFFFF;
                            }                            
                  }               
                  super.drawRowBackground(s,rowIndex,y,height,color,dataIndex);         
            }           
        }
    

    By this you can get any data from the row and according to it give the color.

    0 讨论(0)
提交回复
热议问题