# Alternate FONT colors in dataGrid

**URL:** <https://forum.kirupa.com/t/alternate-font-colors-in-datagrid/261383>\
**Category:** Uncategorized\
**Created:** [May 27, 2008, 5:06am UTC](https://forum.kirupa.com/t/alternate-font-colors-in-datagrid/261383 "2008-05-27T05:06:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayrich86](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jayrich86](https://forum.kirupa.com/u/jayrich86)\
**Post date:** [May 27, 2008, 5:06am UTC](https://forum.kirupa.com/t/alternate-font-colors-in-datagrid/261383/1 "2008-05-27T05:06:41Z")

</div>

Im having some trouble finding any info on alternating the font colors in a datagrid component, i can alternate the background colours, but i’d like to alternate the font colors of the rows instead. Any idea?

---

<div class="post-metadata">

**Author:** ![btibia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/btibia/32/1625_2.png) [@btibia](https://forum.kirupa.com/u/btibia)\
**Post date:** [May 27, 2008, 8:11am UTC](https://forum.kirupa.com/t/alternate-font-colors-in-datagrid/261383/2 "2008-05-27T08:11:07Z")

</div>

Hi,

Show me how you alternate the background colors?

---

<div class="post-metadata">

**Author:** ![jon\_bla](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jon\_bla](https://forum.kirupa.com/u/jon_bla)\
**Post date:** [May 27, 2008, 1:37pm UTC](https://forum.kirupa.com/t/alternate-font-colors-in-datagrid/261383/3 "2008-05-27T13:37:56Z")

</div>

Whopps! I read you question wrong . but cab you post your code here.

and tag it in [as] code here [/ as] without space

---

<div class="post-metadata">

**Author:** ![jon\_bla](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jon\_bla](https://forum.kirupa.com/u/jon_bla)\
**Post date:** [May 27, 2008, 1:43pm UTC](https://forum.kirupa.com/t/alternate-font-colors-in-datagrid/261383/4 "2008-05-27T13:43:51Z")

</div>

and as for btibia

```auto

/*The DataGrid class inherits from the List class, which inherits from the ScrollSelectList class. The default class-level style properties are defined on the ScrollSelectList class, which the Menu component and all List-based components extend. You can set new default style values on this class directly, and these new settings are reflected in all affected components.*/

_global.styles.ScrollSelectList.setStyle("backgroundColor", 0xFF00AA);
/*To set a style property on the DataGrid components only, you can create a new instance of CSSStyleDeclaration and store it in _global.styles.DataGrid.*/

import mx.styles.CSSStyleDeclaration;
if (_global.styles.DataGrid == undefined) {
    _global.styles.DataGrid = new CSSStyleDeclaration();
}
_global.styles.DataGrid.setStyle("backgroundColor", 0xFF00AA);
/*
When you create a new class-level style declaration, you lose all default values provided by the ScrollSelectList declaration, including backgroundColor, which is required for supporting mouse events. To create a class-level style declaration and preserve defaults, use a for..in loop to copy the old settings to the new declaration.
*/

var source = _global.styles.ScrollSelectList;
var target = _global.styles.DataGrid;
for (var style in source) {
    target.setStyle(style, source.getStyle(style));
}
/*
For more information about class-level styles, see Setting styles for a component class in Using ActionScript 2.0 Components.
*/

```

From Live Docs  
[http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/js/html/wwhelp.htm](http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/js/html/wwhelp.htm)
