we did this recently.  Didn't like the setProperties() approach for our situation.  We had a colour attribute in our dataprovider.  So we ended up with something like this for a custom cell renderer.  We have not polished it fully yet, but the idea is there.

<?xml version="1.0" encoding="UTF-8"?>

<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml" height="49" width="100%" >
   
    <mx:Script>
    <![CDATA[
        function setValue( str:String, item:Object, sel:Boolean ) {
           
            this.d.text = item.activity;
            this.setStyle("backgroundColor", item.color);
        }
    ]]>
    </mx:Script>
<!--    
    <mx:Text x="{ (this.width - d.width)/2 }"
            y="{ (this.height)/2 }"
            id="d"
            height="100%"
            width="100"
            fontSize="12"
            fontWeight="bold"
            selectable="false"/>
            -->

    <mx:Text id="d"
            height="100%"
            width="100"
            marginTop="5"
            marginBottom="5"
            fontSize="12"
            fontWeight="bold"
            selectable="false"/>
</mx:Canvas>

On 11/8/05, Parekh, Shweta - BLS CTR <[EMAIL PROTECTED]> wrote:
Darron,
 
I did use setPropertiesAt function as you have suggested. But my problem is that
when I use it the way you have suggested, employee_dg.setPropertiesAt(rowInd, {backgroundColor:0xFFF00});
the bg color of the row does not change instanlty. I have to click somewhere in the datagrid for the color change to take place whereas when I hard code the row index ie. employee_dg.setPropertiesAt(1, {backgroundColor:0xFFF00}); the bg color is changed instantly. I need not click on the datagrid for it to do it. Could you tell me why?
 
Attached is a sample app to see this peculiar behavior..
 
Thanks,
Shweta
 
 

___________________________________
Shweta Parekh
Bureau of Labor Statistics, Room# 5930
202.691.7449

-----Original Message-----
From: [email protected] [mailto: [email protected]] On Behalf Of Darron J. Schall
Sent: Tuesday, November 08, 2005 3:35 PM
To: [email protected]
Subject: Re: [flexcoders] Changing the background color of row in datagrid

Parekh, Shweta - BLS CTR wrote:
>
> I also tried using employee_dg.rows[rowInd].backgroundColor =
> "0xfff00"; for changing the background color for a row but this does
> not work.
>
This should probably be added the to FAQ as it gets asked a lot:

// Use "setPropertiesAt" to set the background color of an individual row:
theListOrGrid.setPropertiesAt( rowIndex, { backgroundColor: 0xFF0000 } );


-d



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS







--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to