This is an automated email from the ASF dual-hosted git repository. yishayw pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit b7599017f2f900dd6a0a8eeb98a658cffaa4eeae Author: DESKTOP-RH4S838\Yishay <yishayj...@hotmail.com> AuthorDate: Wed Mar 11 15:40:14 2020 +0200 Add itemToLabel for DG column --- .../mx/controls/dataGridClasses/DataGridColumn.as | 61 ++++++++++++++++++++++ 1 file changed, 61 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 46cbff6..945f5c5 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 @@ -311,6 +311,67 @@ public class DataGridColumn extends org.apache.royale.html.supportClasses.DataGr // labelFunction //---------------------------------- + public function itemToLabel(data:Object):String + { + if (data == null) + return " "; + + /* + if (labelFunction != null) + return labelFunction(data); + */ + + if (data is XML) + { + try + { + if ((data as XML)[labelField].length() != 0) + data = (data as XML)[labelField]; + //by popular demand, this is a default XML labelField + //else if (data.@label.length() != 0) + // data = data.@label; + } + catch(e:Error) + { + } + } + else if (data is Object) + { + try + { + if (data[labelField] != null) + data = data[labelField]; + } + catch(e:Error) + { + } + } + + if (data is String) + return String(data); + + try + { + return data.toString(); + } + catch(e:Error) + { + } + + return " "; + } + + private var _labelField:String; + public function get labelField():String + { + return _labelField; + } + + public function set labelField(value:String):void + { + _labelField = value; + } + /** * @private * Storage for the labelFunction property.