国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Flex > 正文

Flex 自定義DataGrid實現根據條目某一屬性值改變背景顏色

2024-09-08 18:17:32
字體:
來源:轉載
供稿:網友

自定義拓展的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);//設定顏色 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中實現自定義的datagrid并使用 其rowColorFunction方法

//通過比較每條記錄中dataField為act和stand的大小決定該條記錄的背景顏色 private function setCustomColor(item:Object, color:uint):uint { if (Number(item["act"])<Number(item["stand"])) { return 0x7bbfea; } return color; }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 普宁市| 收藏| 理塘县| 海晏县| 通辽市| 吴桥县| 白山市| 东源县| 临夏县| 新巴尔虎右旗| 河曲县| 和平县| 将乐县| 赫章县| 冕宁县| 登封市| 鄂托克前旗| 靖安县| 青浦区| 和龙市| 旌德县| 喀什市| 淄博市| 梧州市| 五寨县| 左云县| 衡山县| 云浮市| 双柏县| 阿克| 灵石县| 抚顺县| 大足县| 临潭县| 宜城市| 泰安市| 金阳县| 贡山| 苍南县| 澄迈县| 石柱|