Chaitu,

 

This is not a bug – the item renderer is working exactly like it should with your code.

 

Renderers are reused – if you scroll or sort, you need to make sure value are re-assigned for each cell in it’s new position.

With your approach of using the complete event to evaluate whether or not to show an image – it’s a one time thing.

So if row 2 has the image visible – row 2 will always have the image visible.  The image visibility is tied to the row rather than the data itself.

 

What you need to do is override updateDisplayList() in the renderer– this approach runs the visibility logic for every change to the dataGrid display.

Now the image visibility is tied to the data and will update the display appropriately.

 

 

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

<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">

            <mx:Script>

            <![CDATA[

                        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void

                        {

                                    super.updateDisplayList( unscaledWidth, unscaledHeight );

                                   

                                    if(data.Price.valueOf() <= 12){

                                                clockImage.visible = true;       

                                    }

                                    else{

                                                clockImage.visible = false;

                                    }

                        }

            ]]>

            </mx:Script>

           

            <mx:Text id="durationtxt" width="49" text="{data.Price}" color="#000000" paddingTop="5"/>

    <mx:Image id="clockImage" height="20" source="clock.swf" y="5"/>

</mx:HBox>

 

 

Ps. Please don’t use “Urgent’ in the Subject

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Chaitu Vadlapatla
Sent: Wednesday, July 26, 2006 9:50 PM
To: [email protected]
Subject: [flexcoders] Urgent:Sorting going bad on DATA Grids with Images

 

Hey all,

       I really really need some help here. I think it’s a flex bug but I need to use this in a project. Please do help me out

I am using item rendering to be able to put an icon besides the text in a column depending on whether the value inside the text is less than or equal to 12.

It shows it right the first time but when I sort it the clock image just pops up where ever it wants to. Please please take a look at it and let me know if there is a work around for it.

Thanks

Chaitu.

__._,_.___

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