I need to put a button in one of the columns of datagrid tag and the column's value should appear on the buttons label. Any help will be highly appreciated
In flex 3, use the tag mx:itemRenderer
:
<mx:DataGrid id="myDataGrid" dataProvider="{myDP}">
<mx:columns>
<mx:DataGridColumn dataField="field">
<mx:itemRenderer>
<mx:Component>
<mx:Button label="{data.field}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
In flex 4, use spark dataGrid and the s:itemRenderer
tag:
<s:DataGrid dataProvider="{myDP}">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="Price">
<s:itemRenderer>
<fx:Component>
<s:GridItemRenderer>
<s:Button label="{data.Price}"/>
</s:GridItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>