How do i make some of my datagridcolumns non editable or readonly if my flex datagrid is editable
How do i make some of 开发者_StackOverflow社区my datagridcolumns non editable or readonly if my flex datagrid is editable?
DataGridColumn
has property editable
. Just set it to false
.
See the documentation for DataGridColumn.
Here is a quick example of a DataGrid with one editable column:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:DataGrid id="testGrid" editable="true">
<mx:columns>
<mx:DataGridColumn headerText="Column1" dataField="column1" editable="false" />
<mx:DataGridColumn headerText="Column2" dataField="column2" />
</mx:columns>
<mx:dataProvider>
<mx:ArrayCollection>
<mx:Object>
<mx:column1>Some Value</mx:column1>
<mx:column2>Some Other Value</mx:column2>
</mx:Object>
</mx:ArrayCollection>
</mx:dataProvider>
</mx:DataGrid>
</mx:Application>
The first column is not editable, the second one is.
Set the property IsReadOnly=True
精彩评论