You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pi...@apache.org on 2021/01/04 17:36:57 UTC

[royale-asjs] branch develop updated: SparkRoyale: Fix displaying data label based on labelFunction in DropDownList

This is an automated email from the ASF dual-hosted git repository.

piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 12c1e89  SparkRoyale: Fix displaying data label based on labelFunction in DropDownList
12c1e89 is described below

commit 12c1e8913f196b6e0e437190c18e758692ff09af
Author: pzarzycki <pi...@wipro.com>
AuthorDate: Mon Jan 4 17:36:40 2021 +0000

    SparkRoyale: Fix displaying data label based on labelFunction in DropDownList
---
 .../royale/spark/components/beads/DropDownListView.as    | 11 +++++++++--
 .../royale/spark/components/supportClasses/ListBase.as   | 16 ++++++++--------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/DropDownListView.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/DropDownListView.as
index 9312f01..80c882c 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/DropDownListView.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/DropDownListView.as
@@ -109,9 +109,16 @@ package spark.components.beads
             }
             else
             {
-
+                var ddl:DropDownList = (this.host as DropDownList);
+                if (ddl["labelFunction"] != null)
+                {
+                    label.label = ddl["labelFunction"](selectionModel.selectedItem);
+                }
+                else
+                {
+                    label.label = getLabelFromData(selectionModel, selectionModel.selectedItem);
+                }
             }
-            label.label = getLabelFromData(selectionModel,selectionModel.selectedItem);
         }
 
         /**
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as
index ef0e1c5..65da669 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as
@@ -739,9 +739,9 @@ public class ListBase  extends SkinnableContainer
     /**
      *  @private
      */
-    /* private var _labelFunction:Function; 
+     private var _labelFunction:Function;
     
-    [Inspectable(category="Data")] */
+    /*[Inspectable(category="Data")] */
     
     /**
      *  A user-supplied function to run on each item to determine its label.  
@@ -765,10 +765,10 @@ public class ListBase  extends SkinnableContainer
      *  @playerversion AIR 1.5
      *  @productversion Royale 0.9.4
      */
-    /* public function get labelFunction():Function
+    public function get labelFunction():Function
     {
         return _labelFunction;
-    } */
+    }
     
     /**
      *  @private
@@ -776,10 +776,10 @@ public class ListBase  extends SkinnableContainer
     // not implemeneted
     public function set labelFunction(value:Function):void
     {
-        //if (value == _labelFunction)
-            //return;
-            //
-        //_labelFunction = value;
+        if (value == _labelFunction)
+            return;
+
+        _labelFunction = value;
         //labelFieldOrFunctionChanged = true;
         //invalidateProperties(); 
     }