I have a Flex DataGrid where one individual cell needs to be rendered in a different way from others. Specifically, for one row of the grid, one of its cells should be hidden.
The DataGridColumn is set out like this in my .mxml file:
<mx:DataGridColumn editable="false" dataField="interactive" headerText="Select?" width="45">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selectedField="isInteractive"
click="data.isInteractive=!data.isInteractive; this.parent.parent.dispatchEvent(new Event('interactive_changed'));"
paddingLeft="5"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
My initial thought was to add the condition to mx:CheckBox like this:
<mx:CheckBox visible="{!data.isBackground}" ...
but that doesn't work - in fact it messes up the display in a rather entertaining fashion (one of the other cells in the row gets an extra checkbox... go figure).
I suspect it may be possible by using a custom ItemRenderer class but that seems like a lot of code overhead for a fairly simple case. Any thoughts?
(I'm using Flex 3.5 if it's relevant.)