Hi all,

Diving-in am I.  Several developers have asked how to control the 
row backgroundColor of a DataGrid.  The responses have centered on 
using itemRenderers for each column, but I think that there is a 
better way.  As a first component stab, that could possibly become 
useful, I've extended DataGrid; overriding drawRowBackgrounds(), and 
added CSS to allow the conditional change of row backgroundColors.
  
The CSS looks like this:

.rowBackgroundColor1 {
        dataField:              status;
        condition:              eq;
        value:                  delinquent;
        type:                   String;
        backgroundColor:        "0xFF3300";     
        color:                  white;
}

.rowBackgroundColor2 {
        dataField:              accountBalance;
        condition:              lt;
        value:                  0;
        type:                   Number;
        backgroundColor:        "#0033FF";
        color:                  white;
}

.myDataGrid {
       rowBackgroundColors:    
"['.rowBackgroundColor1','.rowBackgroundColor2']";
}

The component mxml:

<comp:RowColorDataGrid styleName="myDataGrid"/>


I'm almost there in the component code, but I'm stuck on a couple of 
things:

1. In drawRowBackgrounds(), I'm looping by curRow, CSS 
rowBackgroundColors, and curCol (Columns) - to match the columns
[curCol].dataField with the CSS fieldName.  This works fine.  The 
problem that I'm having is getting the cell data to compare with the 
CSS value.  I've banged on this for while now, but keep coming up 
short.

2.  Is there a way to draw the row background at the same time that 
the data is rendered?  Currently the row backgrounds are painted and 
a delay occurs before the cells are filed with data.  Not the best 
look.

3. Wish-list:  Is there an easy way to blend (mid-tween) two row 
backgroundColors, should the row meet multiple conditions.  I 
suppose that I would also need to consider the column 
backgroundColor, but let's take it one step at a time.


After reading through several of the base classes, I'm certain that 
this is child's play for most of you.  So, let the public 
humiliation begin.

Thanks for any hints,
Tim Hoff






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcomponents/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to