Hi,
how can access/pass a value object in a custom itemrenderer? The item renderer represents a field in my datagrid and i want to be able access properties from my VO.
Thanks
Hi,
how can access/pass a value object in a custom itemrenderer? The item renderer represents a field in my datagrid and i want to be able access properties from my VO.
Thanks
You will want to override the set data method of the item renderer:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo">
<fx:Script>
<![CDATA[
//Strongly typed VO for use in binding.
[Bindable]
private var myValueObject:MyValueObject;
override public function set data(value:Object) : void
{
//we don't want to update if the value is the exact same.
if(data === value)
return;
//you could simply access the data property but I think
//it is nicer to have strong typing for code hints
super.data = myValueObject = value;
validateNow();
}
]]>
</fx:Script>
<mx:Label text="{myValueObject.name}"/>
</mx:Canvas>