Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15541

iOS: ListView - appendSection() will not display items in the ListView when opening a new window for the first time

    Details

      Description

      Details: If you use listView.appendSection(), then items will not appear in the ListView when opening a new window for the first time.

      This is a regression as this does not occur on SDK 3.1.3.GA.

      Steps to reproduce:
      1. Launch the following app.js code on a iOS device

      var detailTemplate = {
           
          childTemplates: [
                  
              {                             
                  type: 'Ti.UI.Label',     
                  bindId: 'theName',          
                  properties: {            
                        
                      color:'black',
                      font:{fontSize:14,fontWeight:'bold'},
                      top:1,
                      left:8,
                       
                  }
              },
              {                            
                  type: 'Ti.UI.Label',     
                  bindId: 'theCategorie',       
                  properties: {   
                                    
                      color:'darkGray',
                      font:{fontSize:14,fontWeight:'bold'},
                      bottom:1,
                      left:8,
                                       
                  }
              },
                   
          ]
      };
       
       
      var b1 = Ti.UI.createButton({
          title : 'dataset1',
          top:20,
      });
       
       
      b1.addEventListener('click', function() {
           
          var data1 = [
       
              { theName: { text: 'Row 1'},theCategorie:{ text: 'Cat 1'} },
              { theName: { text: 'Row 2'},theCategorie:{ text: 'Cat 2'} },
              { theName: { text: 'Row 3'},theCategorie:{ text: 'Cat 3'} }
           
          ];
           
            
          var listSection1 = Titanium.UI.createListSection({items: data1,headerTitle: 'Data1 Custom Item Template'});
          // this works
          // listView.sections=[listSection1];
          
          // bug is here
          listView.appendSection(listSection1);
          rootWin.openWindow(win2);
      });
       
       
      var win1= Ti.UI.createWindow({title:'Custom Item Template'});
      win1.add([b1,]);
       
       
      var win2 = Ti.UI.createWindow();
       
      var listView = Titanium.UI.createListView(
           
                          {templates: { 'detailTemplate':detailTemplate },
                          defaultItemTemplate: 'detailTemplate',
                      }
      );
           
               
      listView.addEventListener('itemclick', function(e){
           
          //alert ( JSON.stringify(e));
          Ti.API.info(JSON.stringify(e));
          var item = e.section.getItemAt(e.itemIndex);
          Ti.API.info(JSON.stringify(item));
           
               
      });
       
      win2.add(listView);
       
      var rootWin = Ti.UI.iOS.createNavigationWindow({window:win1});
      rootWin.open();
      

      2. Press on "dataset1"

      Actual: Items do not appear (see no_items.png). But, if you go back and press "dataset1" again, then items will appear.

      Expected: If you uncomment line 53 and comment line 56, then items should appear after pressing on "dataset1" for the first time (see items.png)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vduggal Vishal Duggal (Inactive)
                Reporter:
                wluu Wilson Luu (Inactive)
                Reviewer:
                Pedro Enrique (Inactive)
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17678
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration