apache-flexactionscriptdatagriditemrendereritemeditor

DataGrid - Edit the selected row when a button is clicked


I have a very simple DataGrid with 2 columns, some thing like this:

<mx:DataGrid id="grid" >
    <mx:columns>
        <mx:DataGridColumn dataField="name" headerText="Name"/>
        <mx:DataGridColumn dataField="date" headerText="Date"/>
    </mx:columns>
</mx:DataGrid>

What Im trying to do is to activate the edition of the selected row when the user clicks a button. So far I've been unable to find any example of how to do this. I already tried 6 or 7 different approaches but non works. Does any one has a clue how to do this?

How do you get the selected row (NOT selectedItem) of a DataGrid and how can you:

This are the questions that I've been unable to answer

Help will be greatly appreciated.


Solution

  • You can get the selected row with the grid.selectedIndex property. One thought to you problem:

    You can change the item renderer at runtime like this:

    grid.itemRenderer = new ClassFactory(com.myapp.renderers.MyGridItemRenderer);