views:

1727

answers:

1

Hi,

What is the method to set different colors for alternate rows in a flex datagrid? So that two adjacent rows are identified easily?

+6  A: 

Use alternatingItemColors style. You can specify as many colors as you want in the array.

<mx:DataGrid id="dg" alternatingItemColors="[#449933, #994433]"
    dataProvider="{[{d:'ASD', c:'$#'},{d:'WER', c:'^@'},{d:'VCB', c:'*!'}]}">
    <mx:columns>
     <mx:DataGridColumn dataField="d"/>
     <mx:DataGridColumn dataField="c"/>
    </mx:columns>
</mx:DataGrid>

This style takes effect only if no backgroundColor is specified.

Amarghosh
Excuse my color sense :(
Amarghosh
Great.. Thank you.. I left out that work, thing I need to write some custom item renderer for it.. This is a lot easier .. Thanks :-) And your color sense isn't too bad ;-)
Angeline Aarthi