views:

74

answers:

2

Hello guys. I am trying to change the datagrid header color by editing headerColor style. I could change the font size, font family...etc except the headerColor. Would someone help me about it? Thanks a lot.

My code

Mxml

<mx:DataGrid id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{cityinfoResult3.lastResult}">
<mx:columns>
<mx:DataGridColumn headerText="Detail" dataField="detail"/>
<mx:DataGridColumn headerText="Name" dataField="name"/>
</mx:columns>
</mx:DataGrid>

Style

#dataGrid{
headerColors: #ff6600;    //everything works except this one. The color can't be                  
                          //changed?
rollOverColor: #33ccff;
textRollOverColor: #ffffff;
iconColor: #ff0000;
fontFamily: Arial;
fontSize:12;
dropShadowEnabled: true;
alternatingItemColors: #330099, #0000cc;
color: #ffffff;
borderColor: #ffffff;
}
+1  A: 

headerColors needs an array of 2 items in order to draw a gradient. If you want a solid color, I bet something likethis would work:

headerColors: #ff6600, #ff6600 ; 
www.Flextras.com
Ty for helping me again. I tried your code but it gave me style syntax error. I used "headerColors: #ff6600, #ffffff ;" The error is gone but the color can't be changed either...:(
Jerry
headerColors is only supported in Flex 4 if you're using the Halo theme. So you may need to add the compiler argument -theme=${flexlib}/themes/Halo/halo.swc . Once I did that; the colors showed up.
www.Flextras.com
hm...I believe I have to add it like below..-locale en_US -theme=${flexlib}/themes/Halo/halo.swc. The compiler gave me many warning that said "The style "borderColor" is only supported by type 'spark.component.panel' with the theme spark" and can't render my application....
Jerry
Sounds like you're having problems mixing Halo and Spark, then. See if you can create a custom button skin with your gradient in Flash Pro and then use that skin as the headerSkin .
www.Flextras.com
I thought skin can only apply in spark component. Datagrid is mx component.
Jerry
man...This really drive me crazy. The borderThickness style is not working in Flex 4 either....what's going on? :(...
Jerry
After hours of search. I finally got it. Thanks for all the helps..
Jerry
Most mx components have a 'skin' style. Just the skinning process is very different in Halo and Spark. I'm glad you got it working.
www.Flextras.com
ya. the main problem here is the halo theme and spark. Don't know why they want to separate them.
Jerry
+1  A: 

In Flex's CSS, you don't want the [] brackets around your values (though you would want them if you were doing this in straight-up ActionScript).

This should do the trick:

headerColors: #ff6600, #ff6600;

Dan M
Ty..but i already tried i...no luck though.
Jerry