Search code examples
flashdatagridflash-builder

Flash builder: How to get selected Cell value in datagrid?


I have a datagrid that is editable. I was wondering if it's possible to retreive the cell value after user edits the single cell.

My datagrid will trigger griditemEditorSessionSave event if users finish the editing, but I don't know how to get the new cell value.

//script
protected function dg_gridItemEditorSessionSaveHandler(event:GridItemEditorEvent):void
  {
     //I can only get the columnIndex but not the value
      Alert.show (event.columnIndex);

  } 

//mxml

<s:DataGrid id="dg" editable="true" x="5" y="3" width="734" height="153"
                  gridItemEditorSessionSave="dg_gridItemEditorSessionSaveHandler(event)"
>
....
.....

</Datagrid>

Any thoughts? Thanks a lot.


Solution

  • Yes, this is possible..just recently i had this same problems.Im familiar thats theres not much As3 docs into this subject as such more or less on only innitializing the DataGrid and populating it, hence; Not grabbing the values its self.

    On my Datagrid i found it was easier to save the whole dataGrid each time it was edited as i didnt find a way to do this for each individual cell.Just as a text file with comma's seperating the values

    Using a loop function to go through each arrays length, Column / row, if you need complete source code for this project goto:

    http://ffiles.com/flash_files/3559/index.html