简体   繁体   English

如何在spark DataGrid中更改单个单元格的颜色

[英]How to change a color of single cell in spark DataGrid

假设我有rowIndex和columnIndex,我想改变这个单元格的背景颜色

One way to do it is by extending the default itemRenderer and overriding the set data method: 一种方法是扩展默认的itemRenderer并覆盖set data方法:

 override public function set data(value:Object):void {
            super.data = value;
            // retrieve the value of the list-based control's new public property
            var minAge:Number = (listData.owner as MyList).minAge;
            if (data.age < minAge) {
                listLabel.setStyle("color",0xFF0000);
            } else {
                listLabel.setStyle("color",0x000000);
            }
        }

Here is a link to a good example : 这是一个很好的例子的链接:

http://blog.flexdevelopers.com/2009/06/flex-examples-item-renderers-in.html http://blog.flexdevelopers.com/2009/06/flex-examples-item-renderers-in.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM