I´m wondering if there isnt an easier way to achieve this... the code above looks too big :)
and I´m still trying to make it work!

On 5/26/06, Joan Tan <[EMAIL PROTECTED]> wrote:

See if this itemRenderer helps. This itemRenderer will turn the background of a row to red if the value of the column  "myColumnName" in that row is over 50.

 

package {

 

    import mx.controls.Label;

    import mx.controls.dataGridClasses.*;

    import mx.controls.DataGrid;

    import flash.display.Graphics;

    import mx.styles.StyleManager;

 

    [Style(name="backgroundColor", type="uint", format="Color", inherit="no")]

   

      public class BackgroundComp extends Label {

 

       override protected function updateDisplayList(unscaledWidth:Number,

                                                                                unscaledHeight:Number):void

       {

                  super.updateDisplayList(unscaledWidth, unscaledHeight);

                 

                  var g:Graphics = graphics;

                  g.clear();

                  var grid1:DataGrid = DataGrid(DataGridListData(listData).owner);

                  if (grid1.isItemSelected(data) || grid1.isItemHighlighted(data))

                        return;

                  if (data.myColumnName > 50)

                  {

                        g.beginFill(0xFF0000);

                        g.drawRect(0, 0, unscaledWidth, unscaledHeight);

                        g.endFill();

                }

      }

  }

 

}

 

Joan


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Misael
Sent: Friday, May 26, 2006 4:44 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] datagrid

 

Hi,
I want to change a datagrid row background color based on a column in its dataprovider, but all I´ve got searching flexcoders archive are outdated Flex 1.5 solutions or not-very-well-explained cellRenderer tips. How can I achieve this using Flex 2 beta 3? Please, on your example, set the property using a dataprovider column, not a 0xFF0000 value.
Thanks in advance.


--
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






--
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




Reply via email to