No. In fields there is null or undefined - what do you suggest ?

pt., 12 sie 2022 o 14:38 Gabe Harbs <harbs.li...@gmail.com> napisał(a):

> No. That’s probably not what you want. If there’s an empty string that
> should be used.
>
> > On 12 Aug 2022, at 13:57, Piotr Zarzycki <piotrzarzyck...@gmail.com>
> wrote:
> >
> > So maybe it's enough if I just made:
> >
> > If (data[(obj as IHasLabelField).labelField]) ?
> >
> > pt., 12 sie 2022 o 12:46 Gabe Harbs <harbs.li...@gmail.com> napisał(a):
> >
> >> FWIW: undefined == null is true. You don’t need to test for both null
> and
> >> undefined.
> >>
> >>
> >>>> On 12 Aug 2022, at 12:56, pio...@apache.org wrote:
> >>>
> >>> 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 9cf3840b26 Basic: Fix issue where in scenario of providing
> >> object in dataProvider contains fields either null or undefined causes
> >> display [object Object] instead of empty string
> >>> 9cf3840b26 is described below
> >>>
> >>> commit 9cf3840b2646f57a312a121db17a991766307fef
> >>> Author: Piotr Zarzycki <piotrzarzyck...@gmail.com>
> >>> AuthorDate: Fri Aug 12 11:54:54 2022 +0200
> >>>
> >>>   Basic: Fix issue where in scenario of providing object in
> >> dataProvider contains fields either null or undefined causes display
> >> [object Object] instead of empty string
> >>>
> >>>   Example of dp object: {firstName: "Piotr", lastName: null}
> >>> ---
> >>> .../royale/org/apache/royale/html/util/getLabelFromData.as     | 10
> >> +++++++++-
> >>> 1 file changed, 9 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git
> >>
> a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
> >>
> b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
> >>> index 18aa873040..1581f0c21b 100644
> >>> ---
> >>
> a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
> >>> +++
> >>
> b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
> >>> @@ -65,9 +65,17 @@ package org.apache.royale.html.util
> >>>        }
> >>>
> >>>        var label:String = data["label"];
> >>> -        if(label != null){
> >>> +        if(label != null)
> >>> +        {
> >>>            return label;
> >>>        }
> >>> +
> >>> +        if (obj is IHasLabelField && (obj as
> IHasLabelField).labelField
> >> &&
> >>> +                (data[(obj as IHasLabelField).labelField] == null ||
> >> data[(obj as IHasLabelField).labelField] == undefined))
> >>> +        {
> >>> +            return "";
> >>> +        }
> >>> +
> >>>        return "" + data;
> >>>
> >>>    }
> >>>
> >>
> >
> >
> > --
> >
> > Piotr Zarzycki
>


-- 

Piotr Zarzycki

Reply via email to