Linda
Linda

Reputation: 31

How do i make some of my datagridcolumns non editable or readonly if my flex datagrid is editable

How do i make some of my datagridcolumns non editable or readonly if my flex datagrid is editable?

Upvotes: 3

Views: 3266

Answers (2)

Ashish
Ashish

Reputation: 41

Set the property IsReadOnly=True

Upvotes: 2

Carlos
Carlos

Reputation: 2513

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.

Upvotes: 7

Related Questions