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/11 05:45:15 UTC
[2/6] git commit: [flex-sdk] [refs/heads/develop] - Improved addAll
and fixed issue with addItem when list is filtered
Improved addAll and fixed issue with addItem when list is filtered
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/01e92f10
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/01e92f10
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/01e92f10
Branch: refs/heads/develop
Commit: 01e92f1059fed85452b6169be20db5a9089657bf
Parents: a615c6b
Author: Justin Mclean <jm...@apache.org>
Authored: Sat May 11 12:28:39 2013 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Sat May 11 12:28:39 2013 +1000
----------------------------------------------------------------------
.../src/mx/collections/ListCollectionView.as | 25 +++++++++-----
1 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/01e92f10/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 dcffed1..30c4694 100644
--- a/frameworks/projects/framework/src/mx/collections/ListCollectionView.as
+++ b/frameworks/projects/framework/src/mx/collections/ListCollectionView.as
@@ -570,7 +570,10 @@ public class ListCollectionView extends Proxy
*/
public function addItem(item:Object):void
{
- addItemAt(item, length);
+ if (localIndex)
+ addItemAt(item, localIndex.length);
+ else
+ addItemAt(item, length);
}
/**
@@ -622,7 +625,10 @@ public class ListCollectionView extends Proxy
*/
public function addAll(addList:IList):void
{
- addAllAt(addList, length);
+ if (localIndex)
+ addAllAt(addList, localIndex.length);
+ else
+ addAllAt(addList, length);
}
/**
@@ -649,16 +655,17 @@ public class ListCollectionView extends Proxy
}
var length:int = addList.length;
+ var maxLength:int = length
+
+ // incremental index may be out of bounds because of filtering,
+ // so add this item to the end.
+ if (index > maxLength)
+ index = maxLength;
+
for (var i:int=0; i < length; i++)
{
var insertIndex:int = i + index;
-
- // incremental index may be out of bounds because of filtering,
- // so add this item to the end.
- var currentLength:int = this.length;
- if (insertIndex > currentLength)
- insertIndex = currentLength;
-
+
this.addItemAt(addList.getItemAt(i), insertIndex);
}
}