Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2912] iOS: TableViewRow content disappear after window close and open

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-04T23:13:14.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-12 API
ComponentsiOS
Labelsapi, module_tableviewrow, qe-testadded, regression
ReporterEnrico Luciano
AssigneeVishal Duggal
Created2011-04-15T03:32:44.000+0000
Updated2012-10-11T18:39:27.000+0000

Description

Hi,
I have this problem on iphone simulator and latest development environment.
I have a window with a tableview (with custom tableViewRows) and a close button in the bottom.
When I first open the window everything shows up, but when I close the window and then open it again the content of the tableView disappear. I have the tableview with the lines row separators but with nothing is showing in the tableviewrows.
here is how I build the app.js you can test:

Titanium.UI.setBackgroundColor('#333');

var page2 = Titanium.UI.createWindow({  
    title:'page2',
    backgroundColor:'#fff'
});

var data = [];

var listTable = Titanium.UI.createTableView({});

for(var indice=0; indice<15; indice++) {

    var row = Titanium.UI.createTableViewRow();

    var img = Titanium.UI.createImageView({
            image:'KS_nav_ui.png',
            width:50,
            height:50,
            left:0,
            top:0
    });

    var label = Titanium.UI.createLabel({
        text:indice,
        font:{fontSize:14},
        textAlign:'center',
        borderColor:'black'
    });

    row.add(img);
    row.add(label);
    
    row.hasChild=false;
    row.height = 50;
    row.className = 'list';
                
    data.push(row);
}

listTable.bottom = 50;

listTable.setData(data);
        
page2.add(listTable);

var b2 = Titanium.UI.createButton({
    title:'CLOSE',
    bottom:5,
    height:40
});

page2.add(b2);

b2.addEventListener('click',function()
{
    page2.close();
});

var win = Titanium.UI.createWindow({  
    title:'win',
    backgroundColor:'#555'
});

var button = Titanium.UI.createButton({
    title:'OPEN'
});

button.addEventListener('click',function()
        {
            page2.open();
        });
        
win.add(button);

win.open();

Attachments

FileDateSize
app.js2011-04-15T03:32:44.000+00001308

Comments

  1. Hidayet Dogan 2012-05-29

    I have got a same *critical* problem. I got just basic VIEW with vertical layout and Ti.UI.SIZE given as a height and 2 labels on that VIEW. When I click on row and open new window and return back, row content (VIEW) sometimes disappear but the row(s) presences it's height and SECTION titles. I've noticed that row content disappears when I just click on the row and row is highlighted with selected color effect and before the new window opened. Tested with 2.0.1GA2 and 2.1.0 (build from git 05/25/2012). IMHO, priority must be High. I'll try to record a video and submit it.
  2. Hidayet Dogan 2012-05-29

    By the way, the problem started with 2.0.1, it was working well with 1.8.x.
  3. Hidayet Dogan 2012-05-29

    Here is the video of the bugged application. It's tested with 2.1.0. [http://tinypic.com/player.php?v=288rvr6&s=6] I've also noticed that section titles disappear when scrolling table and when section become top shown one.
  4. Hidayet Dogan 2012-05-31

    Here are the test project for the issue (tested with 2.0.1GA2): How to test: Click the button and open window with table, click on random row and open detail window, go back, click again, go back, go back (to main window) click and open window with table again, click on random row, go back.... and going like this. It's not always happen but it randomly disappears row content (container view or labels, I could't determine). I've tried with almost every combination of layout/height/width/top/left/right/bottom properties with container view and labels. FILE: app.js
       Ti.UI.setBackgroundColor('#fff');
       
       var tabGroup = Ti.UI.createTabGroup();
       
       var winMain = Ti.UI.createWindow({
       	url: 'main.js',
       	title: 'Main Window'
       });
       
       var tab1 = Ti.UI.createTab({
       	window: winMain,
       	title: 'Main Window'
       })
       
       tabGroup.addTab(tab1);
       tabGroup.open();
       
    FILE: main.js
       var winTable = Ti.UI.createWindow({
       	url: 'table.js',
       	title: 'Table Window'
       });
       
       var button = Ti.UI.createButton({
       	title: 'Open Window with Table'
       });
       
       button.addEventListener('click', function(e) {
       	Ti.UI.currentTab.open(winTable, {animated: true});
       });
       
       Ti.UI.currentWindow.add(button);
       
    FILE: table.js
       var winDetail = Ti.UI.createWindow({
       	url: 'detail.js',
       	title: 'Detail Window'
       });
       
       var table = Ti.UI.createTableView();
       
       table.addEventListener('click', function(e) {
       	winDetail.sectionIndex = e.rowData.sectionIndex;
       	winDetail.rowIndex     = e.rowData.rowIndex;
       	Ti.UI.currentTab.open(winDetail, {animated: true});
       });
       
       Ti.UI.currentWindow.add(table);
       
       var data = [];
       
       for (var i = 0; i < 5; i++) {
       	data[i] = Ti.UI.createTableViewSection({
       		headerTitle: 'Section ' + i
       	});
       	
       	for (var j = 0; j < 5; j++) {
       		var row = Ti.UI.createTableViewRow({
       			className: 'row',
       			hasDetail: true,
       			sectionIndex: i,
       			rowIndex: j
       		});
       		
       		var container = Ti.UI.createView({
       			layout: 'vertical',
       			height: Ti.UI.SIZE,
       			top: 10,
       			left: 10,
       			bottom: 10,
       			right: 10
       		});
       		
       		container.add(Ti.UI.createLabel({
       			left: 0,
       			text: 'Label ' + j,
       			font: {
       				fontWeight: 'bold',
       				fontSize: 16
       			}
       		}));
       		
       		container.add(Ti.UI.createLabel({
       			top: 5,
       			left: 0,
       			text: 'Sub Label ' + j,
       			font: {
       				fontStyle: 'italic',
       				fontSize: 14
       			}
       		}));
       		
       		row.add(container);
       		data[i].add(row);
       	}
       	
       	table.setData(data);
       }
       
    FILE: detail.js
       var label = Ti.UI.createLabel({
       	text: 'Section: ' + Ti.UI.currentWindow.sectionIndex + ' Row: ' + Ti.UI.currentWindow.rowIndex
       });
       
       Ti.UI.currentWindow.add(label);
       
  5. Hidayet Dogan 2012-06-03

    I've also noticed another bug which is probably related to this one. WebView on Window is also disappears completely after you open, close and open the window again. Main window is opened by TabGroup. And the window contains WebView does NOT use "url" property. It's created and added in same JS file with TabGroup (main Window). If I split window source code containing WebView to another JS file and using "url" property, it does NOT happen. I've tested it with latest Git build (2.1.0 2012-06-02) Shall I open another ticket for this additional issue?
  6. Neeraj Gupta 2012-06-03

    @Hidayet - Yes, please.
  7. Hidayet Dogan 2012-06-04

  8. Vishal Duggal 2012-06-05

    Could not reproduce the issue in the attached app.js but was easily able to reproduce the second issue. Basically a context shutdown issue. When the winTable closes, it destroys the TableView object but does not destroy the winTable object (Created in a different context. As such the tableView still exists in the windows children array. So when you open the winTable window again a second tableView gets added to the children array on execution of table.js The Javascript workaround is simple enough. Add the following code File: table.js
       Ti.UI.currentWindow.addEventListener('close',function(e){
       	Ti.UI.currentWindow.remove(table);
       })
       
    File: detail.js
       Ti.UI.currentWindow.addEventListener('close',function(e){
       	Ti.UI.currentWindow.remove(label);
       })
       
    A separate ticket (TIMOB-9400) has been filed to address this issue.
  9. Vishal Duggal 2012-06-05

    Providing a JS workaround. Issue to fix the problem in the platform will be handled post 2.1.0
  10. Eric Merriman 2012-06-14

    Note to QE- Use the first example code as the second set is covered in TIMOB-9400.
  11. Eric Merriman 2012-06-14

    Verified fixed with SDK 2.1.0.v20120614124151 and iPhone 4 (5.0.1)
  12. Anshu Mittal 2012-07-04

    Reopening to update labels.

JSON Source