Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10456] MobileWeb: tableView deleteRow on deleted row causes Uncaught TypeError: Cannot read property '_parent' of undefined

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-08-15T23:24:15.000+0000
Affected Version/sRelease 2.1.0, Release 2.1.1, Release 2.1.2
Fix Version/sn/a
ComponentsMobileWeb
Labelsapi, qe-mw082012, regression
ReporterDustin Hyde
AssigneeNeeraj Gupta
Created2012-08-15T14:18:48.000+0000
Updated2012-08-25T19:03:18.000+0000

Description

tableView removeRow on a row that was automatically removed from another TableView by appending it to the first tableView causes type error this is a regression, this does not occur in SDK 2.0.2 this does not occur on android, which behaves correctly this crashes ios in a related issue log: Uncaught TypeError: Cannot read property '_parent' of undefined note: when appendRow is called on a shared row in android or ios, the row is not automatically deleted from the first tableView, which is a parity issue in addition to the underlying error test steps: 1. run code:
var win = Ti.UI.createWindow({
	backgroundColor : 'white'
});

var table1 = Ti.UI.createTableView({
	top : 0,
	left : 0,
	width : '100%',
	height : '50%'
});

var row = Ti.UI.createTableViewRow({
	title : 'click top row, then bottom row'
});

table1.appendRow(row);

var table2 = Ti.UI.createTableView({
	bottom : 0,
	left : 0,
	width : '100%',
	height : '50%'
});

win.add(table1);
win.add(table2);

table1.addEventListener('click', function(e) {
	table2.appendRow(e.row);
	table1.deleteRow(e.index); // uncaught error
});

win.open();

Comments

  1. Bryan Hughes 2012-08-15

    Views cannot be added to more than one parent view at a time. Such behavior is undefined. The deleteRow needs to be called *before* the row is added to the second tableview.

JSON Source