Flex Advanced Datagrid Condition Row Color

I am trying to set the row background color for advanced data network management in Flex 3. Does anyone know if this is possible using the style function. Currently, my style function is as follows:

public function myStyleFunc(data:Object, col:AdvancedDataGridColumn):Object 
         {
            if (data["status"] == "PRICING") 
                return {color:0xFF0000 , fontWeight:"bold" , backgroundColor:0xFF0000}; 


            // Return null if the Artist name does not match.
            return null;     
         }      

However, the background color does not change.

I heard on the vine that I might need to override some methods to enable the background color property.

Any help would be appreciated.

Regards Carl

+3
source share
1 answer

I did something similar, but in my case, the color also came from the data, but that will help you. You must override the Datagrid and override the 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);         
        }           
    }

.

+9

Source: https://habr.com/ru/post/1711798/


All Articles