最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Flex 自定義DataGrid實(shí)現(xiàn)根據(jù)條目某一屬性值改變背景顏色

 更新時間:2014年07月27日 14:37:49   投稿:whsnow  
本節(jié)主要介紹了Flex DataGrid根據(jù)條目某一屬性值改變背景顏色,此DataGrid為自定義拓展的,需要的朋友可以參考下

自定義拓展的DataGrid(as類)代碼如下:

package czgh.components 
{ 
import flash.display.Sprite; 

import mx.controls.DataGrid; 
import mx.core.UIComponent; 

public class OptionalDataGrid extends DataGrid 
{ 
private var _rowColorFunction:Function; 
private var _customed:Boolean; 
private var _customerColor:uint=0; 
public function OptionalDataGrid() 
{ 
super(); 
} 

override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void 
{ 
color=0XFFFFFF; 

if(this._rowColorFunction != null) 
{ 
if (dataIndex < this.dataProvider.length) 
{ 
var item:Object=this.dataProvider.getItemAt(dataIndex);//設(shè)定顏色 
color=this._rowColorFunction.call(this, item, color); 
} 
} 



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

override protected function drawHeaderBackground(headerBG:UIComponent):void 
{ 
headerBG.setStyle("borderVisible","false"); 
} 



public function set rowColorFunction(rowColorFunction:Function):void 
{ 
this._rowColorFunction=rowColorFunction; 
} 

public function get rowColorFunction():Function 
{ 
return this._rowColorFunction; 
} 


} 
}

在mxml中實(shí)現(xiàn)自定義的datagrid并使用 其rowColorFunction方法

//通過比較每條記錄中dataField為act和stand的大小決定該條記錄的背景顏色 
private function setCustomColor(item:Object, color:uint):uint 
{ 
if (Number(item["act"])<Number(item["stand"])) 
{ 
return 0x7bbfea; 
} 

return color; 
}

相關(guān)文章

最新評論

河源市| 桦甸市| 衡南县| 舒兰市| 那曲县| 阳春市| 博乐市| 天全县| 江油市| 宣威市| 甘南县| 平武县| 工布江达县| 霍城县| 沁水县| 宝坻区| 常宁市| 株洲市| 康保县| 叙永县| 韩城市| 扶风县| 民和| 潍坊市| 车致| 靖宇县| 汶上县| 东安县| 蓬溪县| 东丽区| 吉木乃县| 娄烦县| 阳江市| 铜山县| 阳城县| 蒙自县| 汝州市| 兰考县| 错那县| 镇坪县| 乡宁县|