Thursday, July 17, 2008

Aligning a checkbox in a Flex Datagrid

When you need to align a checkbox within a Flex based Datagrid the best way to do it is to center it with a Horizontal Box as so


<mx:advanceddatagridcolumn headertext="Parts Ordered?" width="80" datafield="parts_ordered" fontweight="bold">
<mx:itemrenderer>
<mx:component>
<mx:hbox disabledoverlayalpha="0.0" enabled="false" horizontalalign="center" verticalalign="middle">
<mx:checkbox selected="{data.parts_ordered.toString() != 'F'}">
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>

No comments: