婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > flex實現DataGrid高亮顯示數據功能的解決方案

flex實現DataGrid高亮顯示數據功能的解決方案

熱門標簽:南昌crm外呼系統如何 中山外呼系統中間件 天津企業外呼系統代理商 廣州ai外呼系統業務 車載電話機器人 什么行業需要電話機器人 外呼系統號碼顯示 無錫電銷外呼系統代理 地圖標注多家店
flex要高亮數據一般可以使用選中效果或者設置背景,選中效果只能是高亮一條,多條高亮只能設置背景來達到效果。但是原生的DataGrid根本無法達到所要的效果,目前一般就是來改寫原生的DataGrid,只需重新寫一個類來重寫drawRowBackground方法就可以了,代碼如下
復制代碼 代碼如下:

package org.lxh 
{    
    import flash.display.Sprite; 
    import mx.controls.DataGrid; 
    public class SpecialDataGrid extends DataGrid 
    { 
        private var _rowColorFunction:Function;   //用于在外部能通過指定一個方法 去實現改變列的背景色 
        public function SpecialDataGrid() 
        { 
            super(); 
        } 
        public function set rowColorFunction(f:Function):void 
        { 
            this._rowColorFunction = f; 
        } 
        public function get rowColorFunction():Function 
        { 
            return this._rowColorFunction; 
        } 
        //復寫該方法 
        override protected function drawRowBackground(s:Sprite,rowIndex:int,y:Number, height:Number, color:uint, dataIndex:int):void 
        { 
            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); 
        } 
    } 
}

用的時候先引入名稱空間 xmlns:control="org.lxh.*",把原來的DataGrid改成下面這樣
復制代碼 代碼如下:

control:SpecialDataGrid id="planDataGrid" width="100%"  height="100%"  alternatingItemColors="[0xe3eaf2,0xe8f1f8]" dataProvider="{strArray}" rowColorFunction="colorFunction" doubleClick="planDataGrid_doubleClickHandler(event)" doubleClickEnabled="true"> 
                        control:columns> 
                            mx:DataGridColumn dataField="選擇" width="50" sortable="false" resizable="false"  showDataTips="true"> 
                                mx:itemRenderer> 
                                    fx:Component> 
                                        mx:CheckBox change="outerDocument.checkChangeHandlerForPlan(event)"/> 
                                    /fx:Component> 
                                /mx:itemRenderer> 
                            /mx:DataGridColumn> 
                        mx:DataGridColumn dataField="id" headerText="主鍵" visible="false"/> 

                        /control:columns> 
                    /control:SpecialDataGrid>

rowColorFunction屬性用來設置高亮的效果,例如那一列需要高亮,對應的function如下
復制代碼 代碼如下:

    private function colorFunction(item:Object, color:uint):uint 
    { 
                    var col:uint=0xe3eaf2; 
                    if(commonMsg.length > 0){ 
                        for(var i:int=0;icommonMsg.length;i++){ 
                            if(commonMsg.getItemAt(i).id==item.id){ 
                                col=0xF10026; 
                            } 
                        } 
                    } 
                    return col; 

    } 

到這里效果就做出來了

標簽:仙桃 泰州 海西 滄州 呂梁 攀枝花 欽州 佛山

巨人網絡通訊聲明:本文標題《flex實現DataGrid高亮顯示數據功能的解決方案》,本文關鍵詞  flex,實現,DataGrid,高亮,顯示,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《flex實現DataGrid高亮顯示數據功能的解決方案》相關的同類信息!
  • 本頁收集關于flex實現DataGrid高亮顯示數據功能的解決方案的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 桑植县| 壶关县| 陵水| 右玉县| 郯城县| 余姚市| 同德县| 信丰县| 清徐县| 阜平县| 博罗县| 华蓥市| 绥芬河市| 上虞市| 图木舒克市| 简阳市| 惠来县| 诸城市| 白城市| 永新县| 濮阳县| 景泰县| 陵水| 澎湖县| 新闻| 商南县| 乌拉特前旗| 平顶山市| 常熟市| 盐城市| 福安市| 霍城县| 松阳县| 博野县| 辽宁省| 子洲县| 安福县| 获嘉县| 舟曲县| 桑植县| 浦北县|