Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23216] Windows: Data binding: returning false displays false

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid, iOS, Windows
Labelsparity
ReporterRene Pot
AssigneeKota Iguchi
Created2016-04-14T16:09:40.000+0000
Updated2016-06-02T18:53:13.000+0000

Description

I have data binding set up on a ListSection with a transform function. When my transform function return false (not a string, but a boolean) as a variable the databinding actually displays a string "false" instead of nothing like it does on iOS and Android

Attachments

FileDateSize
iPhone_6s_Plus_OS_9_2.png2016-04-18T06:36:13.000+000016337
Nexus_One_API_23.png2016-04-18T06:36:13.000+000030033
Windows_8_1.png2016-04-18T06:36:13.000+000016025

Comments

  1. Kota Iguchi 2016-04-15

    [~topener] I don't quite get the issue but you mean you did transform the ListView? Could you give us a sample code so we can reproduce the issue on our side?
  2. Rene Pot 2016-04-15

       function transform(model){
        return {
            description: false
       }
       }
       
    When using this in the view:
       <ListItem description:text="{description}" />
       
    it will display the string "false" instead of nothing
  3. Christopher Williams 2016-04-15

    Hmm, interesting. And the other platforms just display nothing rather than coercing the boolean to a string value? That seems like our behavior is "more correct" here. I mean if you didn't want the description shown, wouldn't you use an empty string?
  4. Rene Pot 2016-04-15

    iOS and Android display nothing indeed. "false" shouldn't be displayed imho as it does on both other platforms
  5. Kota Iguchi 2016-04-18

    I don't think we have parity across platforms. I have created a sample code to test how true and false rendered in ListView, Label and Button
       var win = Ti.UI.createWindow({ backgroundColor: 'green', layout:'vertical' });
       var listView = Ti.UI.createListView({
           width: Ti.UI.FILL,
           height: '50%'
       });
       var label_t = Ti.UI.createLabel({
           width: Ti.UI.FILL,
           height: '10%',
           text: true
       });
       var label_f = Ti.UI.createLabel({
           width: Ti.UI.FILL,
           height: '10%',
           text: false
       });
       var button_t = Ti.UI.createButton({
           width: Ti.UI.FILL,
           height: '10%',
           title: true
       });
       var button_f = Ti.UI.createButton({
           width: Ti.UI.FILL,
           height: '10%',
           title: false
       });
       var sections = [];
       
       var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' });
       var vegDataSet = [
           { properties: { title: true } },
           { properties: { title: false } },
       ];
       vegSection.setItems(vegDataSet);
       sections.push(vegSection);
       
       listView.sections = sections;
       win.add(listView);
       win.add(label_t);
       win.add(label_f);
       win.add(button_t);
       win.add(button_f);
       
       win.open();
       
    So here's how it's rendered. !iPhone_6s_Plus_OS_9_2.png|thumbnail! !Nexus_One_API_23.png|thumbnail! !Windows_8_1.png|thumbnail! As you can see in the screenshot, * iOS renders 1 for true, and 0 for false in every cases. * Android renders empty string on ListView for either true and false * Android renders "true" for true, "false" for false on Label and Button * Windows renders "true" for true, "false" for false in every cases. So it's obviously a parity issue here but I'm not sure what is the "right" way for this.
  6. Fokke Zandbergen 2016-04-18

    Be aware of how ALOY-1355 and ALOY-1480 influence these findings.
  7. Christopher Williams 2016-05-04

    Given the freeze date for 5.4.0 and the fact that this needs more attention from the iOS/Android guys to get parity right, I need to bump it out.

JSON Source