flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark goldin <markzolo...@gmail.com>
Subject Re: Custom itemrenderer doesn't show data
Date Thu, 17 Mar 2016 14:40:26 GMT
Here is what actually worked:
public class AssetPathRenderer extends UIComponent implements
IListItemRenderer
{
private var _listData:BaseListData;
private var _data:Object;
private var assetPathText:Text;
public function AssetPathRenderer()
{
super();
}
override protected function createChildren() : void
{
super.createChildren();
assetPathText = new Text();
this.addChild(assetPathText);
assetPathText.visible = true;
}
public function get data() : Object
{
return _data;
}
public function set data(value:Object):void
{
if (value)
{
if (value.assetPath != "")
assetPathText.text = value.assetPath;
else
assetPathText.text =  value.path;
}
_data = value;
}
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number ) : void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
assetPathText.setActualSize(unscaledWidth,unscaledHeight);
}
}
The critical piece was:
assetPathText.setActualSize(unscaledWidth,unscaledHeight);



On Thu, Mar 17, 2016 at 9:06 AM OK <OKrueger@edscha.com> wrote:

> Just remember another solution:
> Regarding performance issues probably the fastest way is to don't use any
> itemRenderers.
> So if it works in your scenario you may go with this:
>
> public class MySuperVO
> {
>    public var path:String;
>    public var assetPath:String;
>
>    // Getter that returns the path depending on custom conditions
>    public function get currentPath():string {
>       return assetPath!=""?assetPath:path;
>    }
> }
>
> // Will invoke our getter
> <column id="currentPath"/>
>
> HTH,
> Olaf
>
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Custom-itemrenderer-doesn-t-show-data-tp12269p12276.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message