You can’t prevent recycling of renderers.  The renderer should measure based on 
explicitWidth.


On 6/9/10 7:49 AM, "DevSachin" <[email protected]> wrote:







Hi All,
I have a recycling height issue with cutom renderer of ADG. Renderer is a
UIComponent and contains  a Text control to show string values. My objective
is to create this custom item renderer is to show multiline text and to show
framed border around cell etc.

i am pasting code basic code here. please review and let me know where i
have to change the code to stop re-cycling:
here
textData is Text control
GdeColumn is ADGColumn

public function set data(value:Object):void
{
try
{
_data = value;
if(value == null)
{
return;
}

this.graphics.clear();// Clear old graphics in case of recycling
this.toolTip="";
textData.clearStyle("fontWeight");//clear styles
textData.clearStyle("color");
textData.clearStyle("fontWeight");

gdeColumn = this.styleName as AdvancedDataGridColumn

if(gdeColumn.contentIsText == true)
{
textData.text = gdeColumn.itemToLabel(value); }

this.invalidateSize();
this.dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));

}
catch(e:Error)
{}
}
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
var w:Number = unscaledWidth;
var h:Number = unscaledHeight;
super.updateDisplayList(w , h);
if(textData && (data != null))
{
textData.move(0,0);
textData.setActualSize(w,textData.textHeight+2+2);
}
//super.updateDisplayList(w , h);


}
override protected function createChildren():void
{
if(!textData)
{
textData = new Text();
this.addChild(textData);
}
}
override protected function measure():void
 {
 super.measure();
 measuredHeight =
textData.textHeight+2+2;//getExplicitOrMeasuredHeight has some problem

 }

override protected function commitProperties():void
{
super.commitProperties();
}

--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to