Thanks Alex!  commitProperties() did not work, but updateDisplayList() did.

Scott

Alex Harui wrote:

The list classes set .visible on renderers as part of the recycling, so we're overriding yours.

You should be able to set it in commitProperties or later.

------------------------------------------------------------------------

*From:* [email protected] [mailto:[EMAIL PROTECTED] *On Behalf Of *Scott - FastLane
*Sent:* Monday, September 17, 2007 3:32 AM
*To:* [email protected]
*Subject:* [flexcoders] Invisible checkbox renderer

I am attempting to optimize my renderers in an AdvancedDataGrid. The
following code works perfectly, but it seems I should be able to do this
without the overhead of an HBox. So... I have implemented the following
code and am having trouble seeing why it won't work. If I debug, I see
that this.visible is being set to false... but it always appears
anyway. Seems this should be very simple, I must be overlooking something.

Any Help is appreciated.
Scott

*** This works, but is heavier weight ***

<mx:itemRenderer>
<mx:Component>
<mx:VBox verticalScrollPolicy="off"
horizontalScrollPolicy="off" horizontalAlign="center">
<mx:Script>
<![CDATA[
import fastlane.data.Task;

//hide the checkbox if this is a task
public override function set data(value:Object):void
{
var isTask:Boolean = value is Task;
this.checkBox.visible = (!isTask);
super.data = value;
}
]]>
</mx:Script>
<mx:CheckBox id="checkBox"
selected="{data.isSelected}" labelPlacement="left"
click="parentDocument.setItemSelected(data, event)"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>

*** Would prefer this if it worked ***

public class MyCheckBox extends CenteredCheckBox
{
/**
* Called when the data is set.
*/
public override function set data(value:Object):void
{
var isTask:Boolean = value is Task;

this.visible = !(isTask);
this.invalidateProperties();
//note: have tried invalidateDisplayList() and
UIComponent(this.parent).invalidateDisplayList() as well

super.data = value;
}
}


Reply via email to