加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex DataGrid设置不同行的渲染颜色

发布时间:2020-12-15 04:07:30 所属栏目:百科 来源:网络整理
导读:rowColor:RowColorDataGrid id="dategrId" sortableColumns="false" width="100%" height="100%" fontSize="12" dataProvider="{resultArr}" headerHeight="30" rowColorFunction="calcRowColor" textAlign="center"rowColor:columnsmx:DataGridColumn heade
<rowColor:RowColorDataGrid id="dategrId"
							   sortableColumns="false"
							   width="100%"
							   height="100%"
							   fontSize="12"
							   dataProvider="{resultArr}"
							   headerHeight="30"
							   rowColorFunction="calcRowColor"
							   textAlign="center">
		<rowColor:columns>
			<mx:DataGridColumn headerText="序号"
							   width="50"
							   dataField="rn"
							   headerRenderer="mx.controls.Label"
							   itemRenderer="mx.controls.Label"/>
			<mx:DataGridColumn headerText="时间"
							   width="155"
							   dataField="dateTime"
							   headerRenderer="mx.controls.Label"
							   itemRenderer="mx.controls.Label"/>
		</rowColor:columns>
	</rowColor:RowColorDataGrid>
             /**
             * 对DataGrid每行进行遍历,进行自定义的行渲染
             * **/
            private function calcRowColor(item:Object,rowIndex:int,dataIndex:int,color:uint):uint
            {
                var dt:String=item.categoryId;
                if (dt == "31" || dt == "21")
                {
                    return 0xffdcdc;
                }
                else if (dt == "32" || dt == "22")
                    return 0xffe0ab;
                else if (dt == "33" || dt == "23")
                    return 0xffabab;
                else if (dt == "34" || dt == "24")
                    return 0xabffc7;
                else if (dt == "11")
                    return 0xabc5ff;
                else
                    return null;
            }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读