Thanks guys, got it working.
overridepublicfunctionsetdata(value:Object):void{
if(data.amount < 50)
{
smileImage= 'smile001.png';
}
else if(data.amount >= 50)
{
smileImage= 'smile002.png';
}
}super.data = value;
________________________________
From: Fotis Chatzinikos <[email protected]>
To: [email protected]
Sent: Tuesday, May 5, 2009 12:04:34 PM
Subject: Re: [flexcoders] Sorting columns in a Datagrid don't sort with
itemRenderer...
you should not just do staff in creation complete
set the smilies in the set data function
even if sort works you will not get correct behaviour with just creation
complete
On Tue, May 5, 2009 at 5:21 PM, sailorsea21 <sailorsea21@ yahoo.com> wrote:
Hi everyone, I'm having a problem with sorting columns in a datagrid when using
itemRenderer.
Without the itemRenderer, everything works fine but when I use an itemRenderer,
the column with the itemRenderer doesn't sort, it simply rotates the rows of
that column....
dgColumn.itemRender er = new ClassFactory( Smiles);
Here's my itemRenderer file Smiles.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe. com/2006/ mxml"
creationComplete="setSmileImage( )">
<mx:Script>
<![CDATA[
[Bindable]
private var smileImage:String;
private function setSmileImage( ):void
{
if(data.amount < 50)
{
smileImage= 'smile001.png';
}
else if(data.amount >= 50)
{
smileImage= 'smile002.png';
}
}
]]>
</mx:Script>
<mx:Image id="image" verticalCenter="0" horizontalCenter="0"
source="{smileImage}"/>
</mx:Canvas>
--
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
Fotis.Chatzinikos@ gmail.com,