apache-flex - Datagrid FLEX 中的不同行样式

标签 apache-flex datagrid row

如果在数据字段中找到某个单词,我正在尝试更改数据网格中行的字体颜色。 有没有一种简单的内联方法可以做到这一点?

谢谢

最佳答案

您可以重写DataGrid的drawRowBackground方法,并检查它是否需要自定义背景。
如果是这样,请将新的背景颜色传递给此方法的 super 调用:

protected override function drawRowBackground(s:Sprite, rowIndex:int, 
    y:Number, height:Number, color:uint, dataIndex:int):void
{
    if ((dataProvider[dataIndex] as String).indexOf(someWord) >= 0)
        color = yourCustomColor;
    super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
}

其中 someWord 是您要搜索的单词,yourCustomColor 是表示新背景颜色的 uint,例如:

var yourCustomColor: uint = 0xff0000;

关于apache-flex - Datagrid FLEX 中的不同行样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6015445/

相关文章:

apache-flex - 如何在flex textarea中使文本换行

c++ - MFC CListView 自定义绘图 - 如果文本等于值,则为行着色

apache-flex - 灵活单元 4 -- Hello World

css - 在 Flex3 Air 中创建和编辑 CSS

wpf - 无法更新 DataGrid

c# - DataGrid 按钮,树上的命令绑定(bind)相对源不起作用

c# - WPF 数据网格 : How do I access a ComboBox in a specific row of a DataGridTemplateColumn?

javascript - insertRow 后无法按 ID 删除表行

MeekroDB 中的 mysql_fetch_assoc

flash - 柔性 : How to find out if an object is in a page using SSL/TLS [https protocol]