What event handler can I use to capture new values that have been changed in a flex datagrid.
I have an editable grid and would like to update values based on the edited cell and I am doing this in the itemEditEndHandler
such that when they finish editing a cell I update other cells that are dependent on it. the only problem is in the itemEditEndHandler
the 开发者_JAVA百科new value has not registered yet. If I try and get the value of the cell i find that its still giving me the old value and not the new value that I have entered.
Listen for collectionChange event on the dataProvider
of the DataGrid.
ListCollectionView
objects, i.e. ArrayCollection and XMLListCollection objects, dispatch a CollectionEvent.COLLECTION_CHANGE event whenever there is a change in the collection. Check for the kind property of the dispatched event - if it is CollectionEventKind.UPDATE
, it means that one or more items have been updated. The items array of the event will hold the updated items.
If your datagrid is using a dataProvider that is an ArrayCollection, you can call its refresh() method in the handler triggered by the itemEditor's change event, then call the dataGrid's invalidateList() method.
Use gridItemEditorSessionSave
<s:DataGrid gridItemEditorSessionSave="dataGrid_gridItemEditorSessionSaveHandler(event)" >
...
...
...
</s:DataGrid>
and in the actionscript
protected function dataGrid_gridItemEditorSessionSaveHandler(event:GridItemEditorEvent):void
{
Alert.show("Edited");
}
精彩评论