Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12493] Android: Event bubbling runtime error when deleting rows from a table

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-03-06T22:56:15.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.1.0, 2013 Sprint 05 API, 2013 Sprint 05
ComponentsAndroid
Labelsapi, qe-port, regression
ReporterTony Lukasavage
AssigneeSunila
Created2013-01-30T18:09:53.000+0000
Updated2014-06-19T12:43:16.000+0000

Description

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();

Attachments

FileDateSize
Screen Shot 2013-01-30 at 1.05.48 PM.png2013-01-30T18:09:53.000+000042203

Comments

  1. Tony Lukasavage 2013-02-11

    A workaround would be to do this in the event handler
       e.cancelBubble = true;
       
  2. Ping Wang 2013-02-15

    PR https://github.com/appcelerator/titanium_mobile/pull/3868
  3. Shyam Bhadauria 2013-03-12

    Environment used for verification - Titanium SDK: 3.1.0.v20130311192922 Titanium  Studio:3.0.2.201302151605 Device: Samung GALAXY Tab 620 Android 3.2

JSON Source