I have a datagrid with an itemRenderer in one of the columns. The 
text in that column turns red if a condition is met. The example 
below shows what I mean. However, if you scroll the datagrid or 
resize the screen so that the DG needs to be redrawn, the 
itemRenderer applies the setStyle to the rows that now are where the 
original row was. If you keep scrolling the DG down and up, all the 
rows end up with the style applied to them, wheter or not they meet 
the criteris in the Itemrenderer. Is this a bug? or am I missing 
something here?

---------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute">
        <mx:Script>
                <![CDATA[
                        [Bindable]
                        public var myArray:Array =[{a:10,b:15, c: 21},
{a:5,b:1,c: 4},{a:10,b:15, c: 21},
                        {a:10,b:15, c: 2},{a:10,b:15, c: 2},
{a:10,b:15, c: 2},
                        {a:10,b:15, c: 2},{a:10,b:15, c: 2},
{a:10,b:15, c: 2},
                        {a:10,b:15, c: 2},{a:10,b:15, c: 2},
{a:10,b:15, c: 2},
                        {a:10,b:15, c: 2},{a:10,b:15, c: 2},
{a:10,b:15, c: 2}
                        ];                      
                        
                ]]>
        </mx:Script>
        
          <mx:DataGrid dataProvider="{myArray}">
                <mx:columns>
                        <mx:DataGridColumn headerText="A" 
dataField="a"/>
                        <mx:DataGridColumn headerText="B" 
dataField="b"/>
                        <mx:DataGridColumn headerText="C" 
dataField="c" itemRenderer="myRenderer"/>                       
                        
                </mx:columns>
          </mx:DataGrid>
</mx:Application>


---------------

<--myRenderer.as-->

// ActionScript file
package {
        import mx.controls.Text;

        public class myRenderer extends Text
        {
                 public function myRenderer() {
                        
        }
        override public function set data(value:Object):void {
            super.data = value; 
           
           if (Number(this.text) >  Number(value.a)*2)
                   this.setStyle("color","red");
                   
            super.invalidateDisplayList();
            
        }
        }
}






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

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

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