Flex: Datagrid派发ITEM_EDIT_BEGIN后因fm/focusManager为Null报错的解决方法

Categories: Flex; Tagged with: ; @ January 15th, 2010 22:09

某DataGrid 监听Editor_BEGIN事件, 如果有数据未保存切换界面时, 会弹出Alert, 在弹出Alert之后, 确定切换界面时, DataGrid报错:
DataGrid的itemEditorItemEditBeginHandler方法中:
var fm:IFocusManager = focusManager; 该fm也就是focusManager为Null, 导致出现错误.
恰好focusManager属性为Protected.
解决方法, 在DataGridGrade(该类继承了DataGrid)的onEditBegin方法中增加了

if(focusManager == null) {
	e.preventDefault()
	return;
}



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.