Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

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

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-10-22T11:27:31.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 22, 2013 Sprint 22 API, Release 3.2.0
ComponentsiOS
Labelsmodule_listview, qe-3.2.0, qe-testadded, regression
ReporterWilson Luu
AssigneeVishal Duggal
Created2013-10-18T21:58:14.000+0000
Updated2014-02-21T11:36:17.000+0000

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

FileDateSize
items.png2013-10-18T21:58:14.000+000041120
no_items.png2013-10-18T21:58:14.000+000025862

Comments

  1. Vishal Duggal 2013-10-21

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/4816
  2. Dhirendra Jha 2013-10-23

    Test Environment - Appc Studio - 3.2.0.201310181700 SDK - 3.2.0.v20131022171645 acs -1.0.7 alloy - 1.2.2 titanium - 3.2.0 titanium-code-processor - 1.0.3 Xcode - 5.0.1 OS - Mac OS X Mavericks (10.9) Devices - iPodTouch1 (v7.0.2), iPhone4S (v5.1) Result - Now ListView - appendSection() display items in the listview on opening first time. Hence closing this issue.

JSON Source