|
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
Hey all, -- 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
YAHOO! GROUPS LINKS
__,_._,___ |

