Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4415] iOS: TableView Multiple appendRow Ignored

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-06-27T05:41:14.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sSprint 2011-26, Release 1.7.2
ComponentsiOS
Labelsappendrow, tableview
ReporterDawson Toth
AssigneeStephen Tramer
Created2011-06-15T08:54:57.000+0000
Updated2011-07-06T17:34:15.000+0000

Description

Problem

If you create a table view and immediately call appendRow multiple times, only the last call to appendRow will do anything. So if you add 3 rows, only the 3rd will end up in the table.

Reproduction

Drop the following in an app.js and run it; if this bug is present, you will only see 1 row. Otherwise, you will see 3.
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.open();

var table = Ti.UI.createTableView();

table.appendRow({ title: 'Row 1' });
table.appendRow({ title: 'Row 2' });
table.appendRow({ title: 'Row 3' });

win.add(table);

Workaround

Instead of appending the rows, setData them:
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.add(Ti.UI.createTableView({
    data: [
        { title: 'Row 1' },
        { title: 'Row 2' },
        { title: 'Row 3' }
    ]
}));
win.open();

Associated Helpdesk Ticket

http://appc.me/c/APP-281379

Comments

  1. Eric Merriman 2011-07-06

    Verified fixed with iPhone 4 (4.3.3), iPad 2 (4.3.3) iPod 3rd Gen (4.0.2), iPhone 3GS (3.1.2), SDK 1.7.x r177ece80

JSON Source