You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ma...@apache.org on 2013/10/15 22:38:45 UTC

git commit: [flex-sdk] [refs/heads/develop] - REFIX FLEX-33813 (DataGrid goes blank when scrolled and dataProvider is changed

Updated Branches:
  refs/heads/develop 05cc8f3e9 -> c556895ee


REFIX FLEX-33813 (DataGrid goes blank when scrolled and dataProvider is changed

[Mustella test pass]
- gumbo/components/DataGrid/Properties
- gumbo/components/DataGrid/Styles


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/c556895e
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/c556895e
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/c556895e

Branch: refs/heads/develop
Commit: c556895ee94e39eddc6095c49f47caa4935767c5
Parents: 05cc8f3
Author: mamsellem <ma...@systar.com>
Authored: Tue Oct 15 22:38:31 2013 +0200
Committer: mamsellem <ma...@systar.com>
Committed: Tue Oct 15 22:38:31 2013 +0200

----------------------------------------------------------------------
 .../projects/spark/src/spark/components/Grid.as | 28 +++++++++++++++++---
 .../DataGrid_requireSelection_test001.mxml      |  2 +-
 2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c556895e/frameworks/projects/spark/src/spark/components/Grid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/Grid.as b/frameworks/projects/spark/src/spark/components/Grid.as
index 9dcfbd3..eed7d09 100644
--- a/frameworks/projects/spark/src/spark/components/Grid.as
+++ b/frameworks/projects/spark/src/spark/components/Grid.as
@@ -269,7 +269,9 @@ public class Grid extends Group implements IDataGridElement, IDataProviderEnhanc
      *  rowIndex of the caret after a collection refresh event.
      */    
     private var caretSelectedItem:Object = null;
-
+    private var updateCaretForDataProviderChanged:Boolean = false;
+    private var updateCaretForDataProviderChangeLastEvent:CollectionEvent;
+    
     /**
      *  @private
      *  True while updateDisplayList is running.  Use to disable invalidateSize(),
@@ -4584,6 +4586,13 @@ public class Grid extends Group implements IDataGridElement, IDataProviderEnhanc
             
             caretChanged = false;        
          }
+
+        if (updateCaretForDataProviderChanged)
+        {
+            updateCaretForDataProviderChanged = false;
+            updateCaretForDataProviderChange(updateCaretForDataProviderChangeLastEvent);
+            updateCaretForDataProviderChangeLastEvent = null;
+        }
     }
     
     
@@ -4600,8 +4609,9 @@ public class Grid extends Group implements IDataGridElement, IDataProviderEnhanc
 		
 		if (!variableRowHeight)
 			setFixedRowHeight(gridDimensions.getRowHeight(0));
-        }
 
+	}
+        
     //--------------------------------------------------------------------------
     //
     //  Methods
@@ -5033,7 +5043,7 @@ public class Grid extends Group implements IDataGridElement, IDataProviderEnhanc
     
     // default max time between clicks for a double click is 480ms.
     mx_internal var DOUBLE_CLICK_TIME:Number = 480;
-    
+
     /** 
      *  @private
      *  Return the GridView whose bounds contain the MouseEvent, or null.  Note that the 
@@ -5619,9 +5629,19 @@ public class Grid extends Group implements IDataGridElement, IDataProviderEnhanc
         invalidateSize();
         invalidateDisplayList();
         
-        if (caretRowIndex != -1)
+        if (caretRowIndex != -1)  {
+            if (event.kind == CollectionEventKind.RESET){
+                // defer for reset events 
+                updateCaretForDataProviderChanged = true;
+                updateCaretForDataProviderChangeLastEvent = event;
+                invalidateProperties();
+            }
+            else {
                 updateCaretForDataProviderChange(event);
+            }         
+        }
 
+        
         // Trigger bindings to selectedIndex/selectedCell/selectedItem and the plurals of those.
         if (selectionChanged)
             dispatchFlexEvent(FlexEvent.VALUE_COMMIT);

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c556895e/mustella/tests/gumbo/components/DataGrid/Properties/DataGrid_requireSelection_test001.mxml
----------------------------------------------------------------------
diff --git a/mustella/tests/gumbo/components/DataGrid/Properties/DataGrid_requireSelection_test001.mxml b/mustella/tests/gumbo/components/DataGrid/Properties/DataGrid_requireSelection_test001.mxml
index c089237..032e7d5 100644
--- a/mustella/tests/gumbo/components/DataGrid/Properties/DataGrid_requireSelection_test001.mxml
+++ b/mustella/tests/gumbo/components/DataGrid/Properties/DataGrid_requireSelection_test001.mxml
@@ -420,7 +420,7 @@
 		<body>		
 		    <RunCode code="FlexGlobals.topLevelApplication.dataGrid.selectionMode=GridSelectionMode.MULTIPLE_CELLS"/>
 		    <AssertMethodValue method="value=FlexGlobals.topLevelApplication.dataGrid.selectionContainsCell(0,0)" value="true"/>
-		    <RunCode code="FlexGlobals.topLevelApplication.dataGrid.resetDP()"  waitEvent="enterFrame" waitTarget="stage"/>
+		    <RunCode code="FlexGlobals.topLevelApplication.dataGrid.resetDP2()" waitEvent="updateComplete" waitTarget="dataGrid.grid"  />
 		    <AssertMethodValue method="value=FlexGlobals.topLevelApplication.dataGrid.selectionContainsCell(0,0)" value="true"/> 
 		    <WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/>
 		    <CompareBitmap   numColorVariances="20" maxColorVariance="20" url="../Properties/Baselines/$testID_cell.png" target="dataGrid"/>