flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [04/50] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - - Label in DropDownList shouldn't be taken from selectedItem, but rather straight from dataProvider
Date Mon, 26 Jun 2017 17:50:41 GMT
- Label in DropDownList shouldn't be taken from selectedItem, but rather straight from dataProvider


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

Branch: refs/heads/develop
Commit: 4ddc52c52a7c5e1042d9e4f57b5656b6b81a9962
Parents: 0379edd
Author: piotrz <piotrz@apache.org>
Authored: Mon Jun 5 02:08:07 2017 +0200
Committer: piotrz <piotrz@apache.org>
Committed: Mon Jun 5 02:08:07 2017 +0200

----------------------------------------------------------------------
 .../beads/controllers/DropDownListController.as | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4ddc52c5/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
index 5aafbc7..32268db 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/controllers/DropDownListController.as
@@ -80,7 +80,7 @@ package org.apache.flex.mdl.beads.controllers
 
             dropDownListView.dropDown.addEventListener(MouseEvent.CLICK, onDisplayItemClick);
 
-			setLabelDisplayValue(model.selectedItem);
+			setLabelDisplayValue();
 		}
 
         private function onDisplayItemClick(event:MouseEvent):void
@@ -90,19 +90,20 @@ package org.apache.flex.mdl.beads.controllers
 			model.selectedIndex = eventTarget.index;
 			model.selectedItem = eventTarget.data;
 
-            setLabelDisplayValue(eventTarget.data);
+            setLabelDisplayValue();
 
 			IEventDispatcher(_strand).dispatchEvent(new Event(Event.CHANGE));
         }
 
-		protected function setLabelDisplayValue(data:Object):void
-		{
-			if (model.selectedIndex > -1 && data)
-			{
+        private function setLabelDisplayValue():void
+        {
+            if (model.selectedIndex > -1 && model.dataProvider != null)
+            {
+                var selectedItem:Object = model.dataProvider[model.selectedIndex];
                 dropDownListView.labelDisplay.text = !model.labelField ?
-                        data as String : 
-						data[model.labelField];
-			}
-		}
+                        selectedItem as String :
+						selectedItem[model.labelField];
+            }
+        }
     }
 }


Mime
View raw message