views:

102

answers:

1

Hopefully simple question: I'm trying to set the alternatingItemColors on a datagrid via some values that I set in a CSS file but nothing seems to work.

the CSS file looks something like this:

.FACS0 {color: #B0B0B0;}

.SACS0 {color: #A6A6A6;}

.AICS0
{
    alternatingItemColors: #B0B0B0, #A6A6A6;
}

I tried a variety of different things. First I tried to load AICS0 directly, i.e.

dataGrid.setStyle("alternatingItemColors", "AICS0");

but this leads to a run time error

TypeError: Error #1034: Type Coercion failed: cannot convert "AICS0" to Array.

I then tried

dataGrid.setStyle("alternatingItemColors", ["FACS0", "SACS0"]);

this runs fine but all rows are set to black.

Note: this

dataGrid.setStyle("alternatingItemColors", [0xFF00CC, 0x112200]);

works just fine - unfortunately this won't work for me, i.e. I need to be able to load data from a CSS file.

thank you!

A: 

Use the styleName property

dataGrid.styleName = "AICS0"
Amarghosh
Amarghosh - this compiles and runs fine but has no effect - which i find fascinating. Any other thoughts? Thank you for now!
fred august
@fred try setting the `styleName` mxml itself and see if it has any effects. Have you included the CSS properly?
Amarghosh
OK, found the bug. Thank you for your advice.
fred august