基于IF语句突出显示Flex中的DataGrid行(Highlighting a DataGrid row in Flex based on an IF Statement)

编程入门 行业动态 更新时间:2024-10-23 13:24:37
基于IF语句突出显示Flex中的DataGrid行(Highlighting a DataGrid row in Flex based on an IF Statement)

我有一系列DataGrids,它们会定期从查询中提取数据。 如果该行的一列中的指定值高于某个阈值,我想突出显示整行。 因此,我需要能够解析DataGrid中的每一行,并突出显示具有高于“100”的特定值的任何行。 DataGrids中的数据量会有所不同,并且无法保证有时会有任何数据。

谢谢

'override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); var g:Graphics = graphics; g.clear(); var grid1:DataGrid = DataGrid(DataGridListData(listData).owner); //var rowtotal:int = new int(dp[0].length) ; if (grid1.isItemSelected(data) || grid1.isItemHighlighted(data)) return; if (data[DataGridListData(listData).dataField]== "NJ") { g.beginFill(0xCC0033); g.drawRect(0, 0, unscaledWidth, unscaledHeight); g.endFill(); } }'

I have a series of DataGrids which will pull data in from a query regularly. I want to highlight an entire row if a specified value in one column of that row is above a certain threshold. So I need to be able to parse through every row in a DataGrid and highlight any row that has a specific value above "100" say. The amount of data in the DataGrids is going to vary and there's no guarantee there will be any at times.

Thanks

'override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); var g:Graphics = graphics; g.clear(); var grid1:DataGrid = DataGrid(DataGridListData(listData).owner); //var rowtotal:int = new int(dp[0].length) ; if (grid1.isItemSelected(data) || grid1.isItemHighlighted(data)) return; if (data[DataGridListData(listData).dataField]== "NJ") { g.beginFill(0xCC0033); g.drawRect(0, 0, unscaledWidth, unscaledHeight); g.endFill(); } }'

最满意答案

您必须使用Itemrenderer来实现此目的。 在itemrenderer setdata方法中,您可以编写列的条件,以将行的背景颜色更改为所需的颜色。

You have to use a Itemrenderer for achieving this. In the itemrenderer setdata method you can write the condition for the column for changing the background color of the row to the desired color.

更多推荐

data,DataGrids,DataGrid,电脑培训,计算机培训,IT培训"/> <meta name="descr

本文发布于:2023-08-05 07:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1430205.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语句   DataGrid   Flex   Highlighting   based

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!