2 Replies Latest reply on Oct 3, 2006 2:33 AM by D._Andy

    DataGrid alternating row colors per column

    D._Andy Level 1
      Is there a way to set different alternating colors to each column in a DataGrid. I have a datagrid where I want two of the columns to have different alternating row colors, one column (red and light red) and the other (green and light green).

      Many thanks
        • 1. Re: DataGrid alternating row colors per column
          jlingwai Level 1
          You can simply set the DataGridColumn property to the approprate colors.
          ex.
          <mx:DataGrid y="0" x="0" width="100%">
          <mx:columns>
          <mx:DataGridColumn id="col1" backgroundColor="0x640000" dataField="col1"/>
          <mx:DataGridColumn id="col1" backgroundColor="0xFF0000" dataField="col1"/>
          <mx:DataGridColumn id="col1" backgroundColor="0x006600" dataField="col1"/>
          <mx:DataGridColumn id="col1" backgroundColor="0x33CC33" dataField="col1"/>
          </mx:columns>
          </mx:DataGrid>

          or you can use the setStyle:
          col1.setStyle("backgroudColor", 0x640000)

          • 2. Re: DataGrid alternating row colors per column
            D._Andy Level 1
            Thanks. But I think I did explain what I want properly. For example, lets say we have two columns, column one needs to have two colors (e.g. odds rows need to be Red, and even rows need to be gray) and column two needs to have two different colors per row and different than the colors of column one (e.g. odd rows green, and even rows yellow)

            I have been trying to override Datagrids drawColumnBackground(), but still with no luck.