我有一个数据网格,其中一些列是可编辑的。我有3个列col_quantity,sales_quantity和return_quantity,其中sales_quantity和return_quantity可编辑。我想要的是一旦用户输入sales_quantity和return_quantity,如果总数大于available_quantity,它应该立即显示警报。我写了一个keyup事件来处理这个..
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");
}
但问题是我第一次编辑值sales_quantity和return_quantity它没有显示警报,即使总数大于available_quantity。 如果我再次单击任何一列并按退格键,则会在警报中显示“hi”。 应该用哪个事件来处理这个问题。数据网格中没有Keypressed事件
答案 0 :(得分:2)
DataGrid的帮助页面怎么样?
我会听这个事件“itemEditEnd”:)
UPDATE - Spark DataGrid
请参阅flex手册中的以下事件描述。
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.