Reputation: 451
What's the equivalent of an inline itemRenderer checkbox element in spark?
<mx:AdvancedDataGridColumn headerText="Eliminar" dataField="eliminar" width="100" textAlign="center">
<mx:itemRenderer>
<fx:Component>
<mx:HBox horizontalAlign="center">
<mx:CheckBox id="chkEliminar" change="{data.eliminar = chkEliminar.selected}" selected="{data.eliminar}"/>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>
Upvotes: 2
Views: 880
Reputation: 10107
Both of the other answers here are good for this case, where there's only one subitem, but if you want the itemrenderer to have a layout like an HBox you need to specify it manually:
<s:itemRenderer>
<fx:Component>
<s:itemRenderer>
<s:layout>
<s:HorizontalLayout horizontalAlign="center"/>
</s:layout>
<mx:CheckBox id="chkEliminar" change="{data.eliminar = chkEliminar.selected}" selected="{data.eliminar}"/>
</s:itemRenderer>
</fx:Component>
</s:itemRenderer>
Upvotes: 2
Reputation: 39408
+1 for Jason's answer
Inline itemRenderers work the same in spark as they did in Halo
I will add that if you want to use Spark Components in a renderer, then you either need to implement IDataRenderer interface or use the itemRenderer class. More info here. I would rewrite your existing itemRenderer like this to be Spark:
<fx:Component>
<s:ItemRenderer>
<s:CheckBox id="chkEliminar" change="{data.eliminar = chkEliminar.selected}" selected="{data.eliminar}"/>
</s:ItemRenderer>
</fx:Component>
For the moment, I'm ignoring the act that binding in an itemRenderer is consdered a bad practice and you really should use the dataChange event to modify the selected values.
Upvotes: 2
Reputation: 8050
Inline itemRenderers work the same in spark as they did in Halo.
Spark has its own CheckBox component <s:CheckBox>
you could use, but you can also continue to use the Halo CheckBox <mx:CheckBox>
you've got in your example.
Upvotes: 3