You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by al...@apache.org on 2021/02/25 11:42:40 UTC

[royale-asjs] branch develop updated: in mx DataGridColumn itemtoDataTip added

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

alinakazi 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 5579f84  in mx DataGridColumn itemtoDataTip added
5579f84 is described below

commit 5579f843002af6df82941a371e67726beef4cf5b
Author: alinakazi <al...@gmail.com>
AuthorDate: Thu Feb 25 16:42:24 2021 +0500

    in mx DataGridColumn itemtoDataTip added
---
 .../mx/controls/dataGridClasses/DataGridColumn.as  | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/dataGridClasses/DataGridColumn.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/dataGridClasses/DataGridColumn.as
index 3683e32..1dd40cf 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/dataGridClasses/DataGridColumn.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/dataGridClasses/DataGridColumn.as
@@ -1041,6 +1041,58 @@ public class DataGridColumn extends org.apache.royale.html.supportClasses.DataGr
             dispatchEvent(new Event("labelFunctionChanged"));
         }
 		
+	/**
+     *  Returns a String that the item renderer displays as the datatip for the given data object,
+     *  based on the <code>dataTipField</code> and <code>dataTipFunction</code> properties.
+     *  If the method cannot convert the parameter to a String, it returns a
+     *  single space.
+     * 
+     *  <p>This method is for use by developers who are creating subclasses 
+     *  of the DataGridColumn class.
+     *  It is not for use by application developers.</p>
+     *
+     *  @param data Object to be rendered.
+     *
+     *  @return Displayable String based on the data.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function itemToDataTip(data:Object):String
+    {
+        if (dataTipFunction != null)
+            return dataTipFunction(data);
+
+        
+
+        if (typeof(data) == "object" || typeof(data) == "xml")
+        {
+            var field:String = dataTipField;
+            
+
+            if (field in data && data[field] != null)
+                data = data[field];
+            else if (dataField in data && data[dataField] != null)
+                data = data[dataField];
+			else
+				data = null;
+        }
+
+        if (data is String)
+            return String(data);
+
+        try
+        {
+            return data.toString();
+        }
+        catch(e:Error)
+        {
+        }
+
+        return " ";
+    }
 		//----------------------------------
 		//  dataTipField
 		//----------------------------------