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;
}
}