You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/05/21 10:20:04 UTC

git commit: [flex-sdk] [refs/heads/develop] - Fixed addItemAt location to sorted list (i.e. must be at the end) and the location of added item to a sorted filtered list (even when filtered it needs to be the sort location otherwise it can be out of order

Updated Branches:
  refs/heads/develop 4de87659c -> c2fd27cc9


Fixed addItemAt location to sorted list (i.e. must be at the end) and the location of added item to a sorted filtered list (even when filtered it needs to be the sort location otherwise it can be out of order).


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

Branch: refs/heads/develop
Commit: c2fd27cc9062b86dc70b6cfc05afefe18f6e918b
Parents: 4de8765
Author: Justin Mclean <jm...@apache.org>
Authored: Tue May 21 18:19:41 2013 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Tue May 21 18:19:41 2013 +1000

----------------------------------------------------------------------
 .../src/mx/collections/ListCollectionView.as       |   18 +++++++++-----
 1 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c2fd27cc/frameworks/projects/framework/src/mx/collections/ListCollectionView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/collections/ListCollectionView.as b/frameworks/projects/framework/src/mx/collections/ListCollectionView.as
index 6aceae3..6dc1a2f 100644
--- a/frameworks/projects/framework/src/mx/collections/ListCollectionView.as
+++ b/frameworks/projects/framework/src/mx/collections/ListCollectionView.as
@@ -593,8 +593,12 @@ public class ListCollectionView extends Proxy
 
         var listIndex:int = index;
 		
-        // if we're sorted addItemAt is meaningless, just add to the end
-		if (localIndex && filterFunction != null)
+		// if we're sorted addItemAt is meaningless, just add to the end
+		if (localIndex && sort)
+        {
+            listIndex = list.length;
+        }
+		else if (localIndex && filterFunction != null)
 		{
 			// if end of filtered list, put at end of source list
 			if (listIndex == localIndex.length)
@@ -604,10 +608,6 @@ public class ListCollectionView extends Proxy
 			else 
 				listIndex = list.getItemIndex(localIndex[index]);
 		}
-		else if (localIndex && sort)
-        {
-            listIndex = list.length;
-        }
 		// List is sorted or filtered but refresh has not been called
 		// Just add to end of list
 		else if (localIndex)
@@ -1158,7 +1158,11 @@ public class ListCollectionView extends Proxy
 				{
 					if (filterFunction(item))
 					{
-						loc = getFilteredItemIndex(item);
+						if (sort)
+							loc = findItem(item, Sort.ANY_INDEX_MODE, true);
+						else 
+							loc = getFilteredItemIndex(item);
+						
 						if (firstOne)
 						{
 							addLocation = loc;