开发者

Problems setting alternatingItemColors from CSS style (Flex)

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, 开发者_JS百科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!


Use the styleName property

dataGrid.styleName = "AICS0"


If you want ALL of your DataGrids to have the same alternating colors, use this in your CSS:

DataGrid
{
    alternating-item-colors: #B0B0B0, #A6A6A6;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜