Linda
Linda

Reputation: 1

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 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.

Upvotes: 0

Views: 251

Answers (3)

HimalayanCoder
HimalayanCoder

Reputation: 9850

Use gridItemEditorSessionSave

<s:DataGrid gridItemEditorSessionSave="dataGrid_gridItemEditorSessionSaveHandler(event)" >
...
...
...
</s:DataGrid>

and in the actionscript

protected function dataGrid_gridItemEditorSessionSaveHandler(event:GridItemEditorEvent):void
            {
                Alert.show("Edited");
            }

Upvotes: 0

Amarghosh
Amarghosh

Reputation: 59451

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.

Upvotes: 2

Robusto
Robusto

Reputation: 31883

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.

Upvotes: 0

Related Questions