flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mih...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-34838 CAUSE: When there is a column sort applied, GridItemEditor.save() is fooling the grid dataProvider into thinking that it's correctly sorted when it's not: by setting dataProvider.sort = null, makin
Date Wed, 20 May 2015 14:28:40 GMT
Repository: flex-sdk
Updated Branches:
  refs/heads/develop 4e8e0fc6e -> fee761ffc


FLEX-34838
CAUSE:
When there is a column sort applied, GridItemEditor.save() is fooling the grid dataProvider
into thinking that it's correctly sorted when it's not: by setting dataProvider.sort = null,
making the desired change, and then re-setting the sort, the currently-edited row stays in
the same position, but the dataProvider now believes the selectedItem is in the correct position
given the sort (I say that because ListCollectionView.getItemIndex() uses the sort when it's
not null, but that only works if all the items are correctly sorted).

SOLUTION:
GridItemEditor doesn't do the sort ignoring trick anymore, which means that if needed, the
currently selected row will jump to another location based on the sorting rule, and that getItemIndex()
will work correclty. To compensate for the row potentially jumping to another location, Grid
now scrolls to where the item has landed.


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

Branch: refs/heads/develop
Commit: fee761ffca661961c317d381f1fa5cc74ca6928a
Parents: 4e8e0fc
Author: Mihai Chira <mihaic@apache.org>
Authored: Wed May 20 16:24:27 2015 +0200
Committer: Mihai Chira <mihaic@apache.org>
Committed: Wed May 20 16:24:27 2015 +0200

----------------------------------------------------------------------
 .../projects/spark/src/spark/components/Grid.as     |  3 +++
 .../spark/components/gridClasses/GridItemEditor.as  | 16 ----------------
 2 files changed, 3 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/fee761ff/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 d327377..78b2429 100644
--- a/frameworks/projects/spark/src/spark/components/Grid.as
+++ b/frameworks/projects/spark/src/spark/components/Grid.as
@@ -5396,7 +5396,10 @@ public class Grid extends Group implements IDataGridElement, IDataProviderEnhanc
                 {
                     const oldLocation:int = event.oldLocation;
                     if ((oldCaretRowIndex >= oldLocation) && (oldCaretRowIndex
< (oldLocation + itemsLength)))
+                    {
                         caretRowIndex += location - oldLocation;
+                        ensureCellIsVisible(caretRowIndex, -1);
+                    }
                 }
                 break;                        
                 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/fee761ff/frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as
b/frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as
index aaece2d..d623331 100644
--- a/frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as
+++ b/frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as
@@ -520,18 +520,6 @@ public class GridItemEditor extends Group implements IGridItemEditor
 
         if (property && data[property] !== newData)
         {
-            // If the data is sorted, turn off the sort for the edited data.
-            var sort:ISort = null;
-            if (dataGrid.dataProvider is ICollectionView)
-            {
-                var dataProvider:ICollectionView = ICollectionView(dataGrid.dataProvider);
-                if (dataProvider.sort)
-                {
-                    sort = dataProvider.sort;
-                    dataProvider.sort = null;
-                }
-            }
-
             var oldData:Object = data[property];
             data[property] = newData;
             
@@ -539,10 +527,6 @@ public class GridItemEditor extends Group implements IGridItemEditor
             // no longer point to the top-level data object and the complete path to the
property
             // so use the original values.
             dataGrid.dataProvider.itemUpdated(this.data, column.dataField, oldData, newData);
-            
-            // Restore the sort. The data will not be sorted due to this change.
-            if (sort)
-                ICollectionView(dataGrid.dataProvider).sort = sort;
         }
 
         return true;


Mime
View raw message