flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [08/14] git commit: [flex-asjs] [refs/heads/develop] - handle having dp set after selectedIndex
Date Fri, 23 Jan 2015 20:24:18 GMT
handle having dp set after selectedIndex


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

Branch: refs/heads/develop
Commit: e2c1c4cf096086709109d2d147d93e6eb5131c00
Parents: 874cc1b
Author: Alex Harui <aharui@apache.org>
Authored: Thu Jan 15 16:18:53 2015 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Jan 23 12:24:04 2015 -0800

----------------------------------------------------------------------
 .../org/apache/flex/html/beads/models/ArraySelectionModel.as    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e2c1c4cf/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as
index 24c383c..cf692fc 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/models/ArraySelectionModel.as
@@ -86,6 +86,9 @@ package org.apache.flex.html.beads.models
 		public function set dataProvider(value:Object):void
 		{
             _dataProvider = value;
+            if (_selectedIndex != -1)
+                _selectedItem = (_dataProvider == null || _selectedIndex >= _dataProvider.length)
? null : 
+                    _dataProvider[value];
 			dispatchEvent(new Event("dataProviderChanged"));
 		}
 
@@ -136,7 +139,7 @@ package org.apache.flex.html.beads.models
 		public function set selectedIndex(value:int):void
 		{
 			_selectedIndex = value;
-			_selectedItem = (value == -1) ? null : (value < _dataProvider.length) ? _dataProvider[value]
: null;
+			_selectedItem = (value == -1 || _dataProvider == null) ? null : (value < _dataProvider.length)
? _dataProvider[value] : null;
 			dispatchEvent(new Event("selectedIndexChanged"));			
 		}
 		


Mime
View raw message