Use editable property to make the grid uneditable. draggableColumns property used to enable/disable column resizing (true by default). variableRowHeight property used to tell Flex to resize row's height according to renderer. The columns for the grid can be specified within <mx:columns> tags. Useful when we want the order of columns to be different from what is received.
Each column is specified using <mx:DataGridColumn> tag. Use its dataField property to specify the field to use to populate, headerText to give column header and editable to determine if it is editable (The parent grid has to be editable for this).
<mx:DataGrid id="myGrid" editable="true" draggableColumns="false">
<mx:columns>
<mx:DataGridColumn dataField="field1" headerText="Field1 Data" editable="false"/>
<mx:DataGridColumn dataField="editableField" headerText="Input"/>
</mx:columns>
</mx:DataGrid>
Q&A
- How can you make a DataGrid editable?
- How do you control column resizing in a DataGrid?
- What will you do if you want the order of columns to be different from the order of data received in a DataGrid?
- Briefly explain the steps involved in initializing a column in a DataGrid.