user1419919
user1419919

Reputation: 35

Flex: which event is fired as soon as user enters a number in datagrid column?

I have a datagrid in which some columns are editable. I have 3 colums available_quantity, sales_quantity and return_quantity out of which sales_quantity and return_quantity editable. What i want is once the user enters sales_quantity and return_quantity and if there total is greater than available_quantity it should immediately display the alert. I wrote keyup event to handle this..

protected function dataGrid_keyUpHandler(event:KeyboardEvent):void
        {
            // TODO Auto-generated method stub
            var avail_qty:int=parseInt(dataGrid.selectedItem.available_qty);
            var return_qty:int=parseInt(dataGrid.selectedItem.return_qty);
            var sales_qty:int=parseInt(dataGrid.selectedItem.sales_qty);
            var total:int=return_qty + sales_qty;
            if(total>avail_qty)
             Alert.show("hi");
        }

but the problem is first time when i edit the value sales_quantity and return_quantity it does not show me alert even there total is greater than available_quantity. If i click any one of the column again and press backspace then it shows me "hi" in alert. which event should b used to handle this. Keypressed event is not available in datagrid

Upvotes: 1

Views: 554

Answers (1)

Adrian Pirvulescu
Adrian Pirvulescu

Reputation: 4340

How about the help pages of the DataGrid ?

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/DataGrid.html#eventSummary ???

I would listen for this event "itemEditEnd" :)


UPDATE - Spark DataGrid

See following event description from flex manual.

gridItemEditorSessionCancel
Dispatched after the item editor has been closed without saving its data.   

gridItemEditorSessionSave
Dispatched after the data in item editor has been saved into the data provider and the editor has been closed.  

gridItemEditorSessionStart
Dispatched immediately after an item editor has been opened.    

gridItemEditorSessionStarting
Dispatched when a new item editor session has been requested.

Upvotes: 2

Related Questions