简体   繁体   中英

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:

 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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