flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Initialize accordion with collapsed elements
Date Tue, 29 Nov 2016 10:24:41 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 9e3df4a21 -> bba0be9d1


Initialize accordion with collapsed elements


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

Branch: refs/heads/develop
Commit: bba0be9d104ba8835bec2117c52eea92e7d140b5
Parents: 9e3df4a
Author: Harbs <harbs@in-tools.com>
Authored: Tue Nov 29 12:24:35 2016 +0200
Committer: Harbs <harbs@in-tools.com>
Committed: Tue Nov 29 12:24:35 2016 +0200

----------------------------------------------------------------------
 .../apache/flex/html/beads/AccordionCollapseBead.as   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bba0be9d/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
index f0e9081..75782c6 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/AccordionCollapseBead.as
@@ -18,6 +18,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads
 {
+	import org.apache.flex.core.IItemRendererParent;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.core.ValuesManager;
@@ -39,6 +40,19 @@ package org.apache.flex.html.beads
 		{
 			_strand = value;
 			host.model.addEventListener("selectedIndexChanged", selectedIndexChangedHandler);
+			var idx:int = host.selectedIndex;
+			if(idx < 0)
+				idx = 0;
+
+			var dg:IItemRendererParent = IListView(host.view).dataGroup as IItemRendererParent;
+			var numElems:int = dg.numElements;
+			for(var i:int = 0; i < numElems; i++){
+				if(i == idx)
+					continue;
+
+				var elem:ICollapsible = dg.getItemRendererForIndex(i) as ICollapsible;
+				elem.collapse();
+			}
 		}
 		
 		protected function get host():Accordion


Mime
View raw message