flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Make sure index and item are sychronized.
Date Sun, 17 Sep 2017 12:11:14 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 5109c4022 -> 814b90d7d


Make sure index and item are sychronized.


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

Branch: refs/heads/develop
Commit: 814b90d7db56d50a2336dfbd61b5bc77ad18a464
Parents: 5109c40
Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
Authored: Sun Sep 17 15:10:11 2017 +0300
Committer: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
Committed: Sun Sep 17 15:10:11 2017 +0300

----------------------------------------------------------------------
 .../flex/html/beads/models/ArrayListSelectionModel.as |  6 ++++--
 .../flex/html/beads/models/ArraySelectionModel.as     | 14 ++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/814b90d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
index d2a2b4b..950e350 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArrayListSelectionModel.as
@@ -87,9 +87,11 @@ package org.apache.flex.html.beads.models
             if (value == _dataProvider) return;
 
             _dataProvider = value as IArrayList;
+			if(!_dataProvider || _selectedIndex >= _dataProvider.length)
+				_selectedIndex = -1;
             if (_selectedIndex != -1)
-                _selectedItem = (_dataProvider == null || _selectedIndex >= _dataProvider.length)
? null :
-                    _dataProvider.getItemAt(_selectedIndex);
+                _selectedItem = _dataProvider.getItemAt(_selectedIndex);
+			
 			dispatchEvent(new Event("dataProviderChanged"));
 		}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/814b90d7/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
index 7059ada..9e3b806 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/models/ArraySelectionModel.as
@@ -85,12 +85,14 @@ package org.apache.flex.html.beads.models
          */
 		public function set dataProvider(value:Object):void
 		{
-            if (value == _dataProvider) return;
-            
-            _dataProvider = value;
-            if (_selectedIndex != -1)
-                _selectedItem = (_dataProvider == null || _selectedIndex >= _dataProvider.length)
? null : 
-                    _dataProvider[_selectedIndex];
+			if (value == _dataProvider) return;
+			
+			_dataProvider = value;
+			if(!_dataProvider || _selectedIndex >= _dataProvider.length)
+				_selectedIndex = -1;
+			if (_selectedIndex != -1)
+				_selectedItem = _dataProvider[_selectedIndex];
+			
 			dispatchEvent(new Event("dataProviderChanged"));
 		}
 


Mime
View raw message