You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/05/03 16:34:44 UTC
[30/50] git commit: [flex-sdk] [refs/heads/master] - FLEX-34216
accept patch from Mihai Chira
FLEX-34216 accept patch from Mihai Chira
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/4c350ade
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/4c350ade
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/4c350ade
Branch: refs/heads/master
Commit: 4c350ade7b903fa9ffbafd35b0c0ffff918fd161
Parents: 6517a4b
Author: Alex Harui <ah...@apache.org>
Authored: Thu Apr 17 10:30:43 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Apr 17 10:30:43 2014 -0700
----------------------------------------------------------------------
.../components/gridClasses/DataGridEditor.as | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/4c350ade/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as b/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
index 2971962..9aaa3c6 100644
--- a/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
+++ b/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
@@ -532,6 +532,7 @@ public class DataGridEditor
o.removeEventListener(KeyboardEvent.KEY_DOWN, editor_keyDownHandler);
o.removeEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
+ o.removeEventListener(Event.REMOVED_FROM_STAGE, editor_removedFromStageHandler);
o.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, editor_keyFocusChangeHandler);
addRemoveFlexEventEnterListener(DisplayObject(o), false);
@@ -673,7 +674,7 @@ public class DataGridEditor
var editor:IEventDispatcher = itemEditorInstance ? itemEditorInstance : editedItemRenderer;
editor.addEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
-
+ editor.addEventListener(Event.REMOVED_FROM_STAGE, editor_removedFromStageHandler);
// listen for keyStrokes on the itemEditorInstance (which lets the grid supervise for ESC/ENTER)
editor.addEventListener(KeyboardEvent.KEY_DOWN, editor_keyDownHandler);
editor.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, editor_keyFocusChangeHandler, false, 1000);
@@ -1574,6 +1575,23 @@ public class DataGridEditor
* @private
* Closes the itemEditorInstance if the focus is outside of the data grid.
*/
+ private function editor_removedFromStageHandler(event:Event):void
+ {
+ if (itemEditorInstance || editedItemRenderer)
+ {
+ // If we can't save the data, say, because the data was invalid,
+ // then cancel the save.
+ if (!dataGrid.endItemEditorSession())
+ {
+ dataGrid.endItemEditorSession(true);
+ }
+ }
+ }
+
+ /**
+ * @private
+ * Closes the itemEditorInstance if the focus is outside of the data grid.
+ */
private function editor_focusOutHandler(event:FocusEvent):void
{
//trace("editor_focusOutHandler " + event.relatedObject);