CheckBox renderer and editor for DataGrid
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
[Bindable]
private var myData:ArrayCollection = new ArrayCollection([
{
dataField1:"Order #1",
dataField2:"AAA",
dataField3:3,
dataField4:new Date(2010, 0, 1),
dataField5:true
},
{
dataField1:"Order #2",
dataField2:"BBB",
dataField3:3,
dataField4:new Date(2010, 0, 5),
dataField5:false
}
]);
</mx:Script>
<mx:DataGrid id="myDG" dataProvider="{myData}" variableRowHeight="true" width="500" height="250" editable="true">
<mx:columns>
<mx:DataGridColumn dataField="dataField1" headerText="Order #" editable="false"/>
<mx:DataGridColumn dataField="dataField2" headerText="Name" editable="false"/>
<mx:DataGridColumn dataField="dataField3" headerText="Quantity" itemEditor="mx.controls.NumericStepper" editorDataField="value"/>
<mx:DataGridColumn dataField="dataField4" headerText="Date" itemRenderer="mx.controls.DateField" rendererIsEditor="true" editorDataField="selectedDate"/>
<mx:DataGridColumn dataField="dataField5" itemRenderer="mx.controls.CheckBox" rendererIsEditor="true" editorDataField="selected"/>
</mx:columns >
</mx:DataGrid>
</mx:Application>
Related examples in the same category