Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11894] Android: TableView - If you dynamically add items to the TableView, subsequent items will not appear in the table

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-11-30T22:07:54.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.0, Release 3.1.0, 2012 Sprint 24, 2012 Sprint 24 API
ComponentsAndroid
Labelsapi, module_tableview, qe-and100112, qe-testadded, regression
ReporterWilson Luu
AssigneeIngo Muschenetz
Created2012-11-29T19:02:18.000+0000
Updated2013-07-17T11:10:53.000+0000

Description

*Details:* If you dynamically add items to the TableView, subsequent items will not appear in the table. *This is a regression.* Bug does not appear in 2.1.4.GA and does not appear on iOS. *Steps to reproduce:* 1. Add the following code to app.js:
var win = Ti.UI.createWindow({
	backgroundColor:'#000',
	layout:'vertical'
});

var message = Ti.UI.createTextField({
    hintText: 'Enter message',
    height: 100,
    borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});

message.addEventListener('return', function (evt) {
    if (!message.value) {
        return;
    }
    addMessage(message.value);
    message.value = '';
    message.focus();
});
win.add(message);

var tableView = Ti.UI.createTableView({});

win.add(tableView);

win.open();

function addMessage(message) {
	
	var row = Ti.UI.createTableViewRow({});
	
	var container = Ti.UI.createView({
		height: Ti.UI.SIZE,
		backgroundColor: '#fff',
		borderColor: '#ccc', borderWeight: 1
	});
	
	var label = Ti.UI.createLabel({
	    text: message,
	    font: { fontSize: 12, fontWeight: 'bold' },
	    height: 50
	})
	        
	container.add(label);
	row.add(container);
	if (tableView.data.length == 0) {
            tableView.appendRow(row);
    }
    else {
        tableView.insertRowBefore(0, row);
    }
}
2. Install and launch app to an Android device 3. Enter at least 3 messages *Actual:* On the S3, three or more messages will not be added to the TableView (see s3_3_0_X.png) On the Droid 1, you will only see 1 message. Subsequent messages will not appear (see droid1_3_0_X.png) *Expected:* Adding messages should appear in the TableView (see 2_1_4_GA.png)

Attachments

FileDateSize
2_1_4_GA.png2012-11-29T19:02:18.000+000076809
droid1_3_0_X.png2012-11-29T19:02:18.000+000048327
s3_3_0_X.png2012-11-29T19:02:18.000+000076464

Comments

  1. Vishal Duggal 2012-11-30

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/3502
  2. Vishal Duggal 2012-11-30

    Backport to 3_0_X https://github.com/appcelerator/titanium_mobile/pull/3503
  3. Natalie Huynh 2012-12-04

    Tested with 3.0.0.v201211300200208 on Galaxy S3 4.0.4

JSON Source