problem
When attempting to delete a row in a table by clicking on a UI element in that row, Titanium generates a runtime error on Android (attached).
What appears to be happening is that the event (click) triggered on the UI element within the row is attempting to bubble to the row itself, which no longer exists if the action is to delete the row. This makes a lot more sense in the test case. This may be preventable by messing with the event bubbling properties, but still presents a regression from previous versions.
This error does not occur on iOS with this test case.
test case
This problem surfaced in an Alloy app when I updated to TiSDK 3.0.0.GA, but I have created a pure Titanium test case to make things easier. Click the "delete" button and you should get the runtime error.
var win = Ti.UI.createWindow({
backgroundColor: '#fff',
fullscreen: false,
exitOnClose: true
});
var table = Ti.UI.createTableView();
var row = Ti.UI.createTableViewRow({
height: '50dp',
});
var button = Ti.UI.createButton({
title: 'delete'
});
button.addEventListener('click', function(e) {
table.setData([]);
});
row.add(button);
table.setData([row]);
win.add(table);
win.open();
A workaround would be to do this in the event handler
PR https://github.com/appcelerator/titanium_mobile/pull/3868
Environment used for verification - Titanium SDK: 3.1.0.v20130311192922 Titanium Studio:3.0.2.201302151605 Device: Samung GALAXY Tab 620 Android 3.2