首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

AdvancedDatagrid改变行的色彩

2012-09-04 
AdvancedDatagrid改变行的颜色最早我尝试重写AdvancedDatagrid的drawRowBackGrounds方法,如下:?override p

AdvancedDatagrid改变行的颜色

最早我尝试重写AdvancedDatagrid的drawRowBackGrounds方法,如下:

?

override protected function drawRowBackground(s:Sprite,rowIndex:int,y:Number, height:Number, color:uint, dataIndex:int):void?

{?

if(dataProvider){

var hcv:HierarchicalCollectionView = dataProvider as HierarchicalCollectionView ;

var hd:HierarchicalData = hcv.source as HierarchicalData ;

var ac:ArrayCollection = hd.source as ArrayCollection ;

if(ac.length > 0 && dataIndex < ac.length){

var item:AlarmVO = ac[dataIndex] as AlarmVO ;

if(item.activeStatus == "0"){

color = 0xCCCCCC ;

}

}

super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);

}

}

?

存在问题:当有节点打开或关闭的时候,变灰的行是错误的。

?

改进方法来自这里http://www.forestandthetrees.com/2008/10/21/adg-color-rows-by-depth/

用到了之前没了解过的类?HierarchicalCollectionViewCursor?

?

override protected function void        var as                  //if the index is less than the length, the row has no data              //content              if nullif var as var switch case 1break;                         case 2break;                         case 3break;                     super.drawRowBackground(s,rowIndex,y,height,color,dataIndex);        }

?

热点排行