我有一个DataGrid,我需要根据条件更改特定行的背景颜色。我已达到这一点,但只有包含条件的单元格才会改变背景。我使用以下代码作为项呈示器。我需要以相同的方式填充对应于该单元格的整行
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
var g:Graphics = graphics;
g.clear();
var grid1:AdvancedDataGrid = AdvancedDataGrid(AdvancedDataGridListData(listData).owner);
//var rowtotal:int = new int(dp[0].length) ;
if (grid1.isItemSelected(data) || grid1.isItemHighlighted(data))
return;
var dp:Array = Array((listData.owner as AdvancedDataGrid).dataProvider);
var rowtotal:int = new int(dp[0].length) ;
var i:int= new int(0);
for (i=0; i < rowtotal; i++)
{
if (data[AdvancedDataGridListData(listData).dataField]== "NJ")
{
g.beginFill(0xCC0033);
g.drawRect(0, 0, unscaledWidth, unscaledHeight);
g.endFill();
}
}
}