[AC-1353] Setting cancelBubble TRUE doesn't work in TableView
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2014-08-03T15:27:55.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | bubbleparent, tableview |
| Reporter | Fokke Zandbergen |
| Assignee | Shuo Liang |
| Created | 2014-07-21T04:28:13.000+0000 |
| Updated | 2016-03-08T07:37:46.000+0000 |
Description
As the following example shows you will still get 2 alerts if you click on the button, even though the button sets
cancelBubble = true, which should prevent the event from bubbling to the row and table.
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var row = Ti.UI.createTableViewRow();
var btn = Ti.UI.createButton({title:'click me'});
btn.addEventListener('click', function(e) {
e.cancelBubble = true;
alert('hi from row');
});
row.add(btn);
var table = Ti.UI.createTableView({
top: 20,
data: [row]
});
table.addEventListener('click', function(e) {
alert('hi from table');
});
win.add(table);
win.open();
Hi, You'd better change line 9 to
as the e stands for the event for callback function, not the component. Regards, ShuoCorrected that, sorry ;)
Tried your new test case, It works well on iOS simulator 7 for both SDK 3.3.0 and 3.2.3. Clicking button only trigger one alert. What kind of device did you use to reproduce this problem.
I'm limited in what I can do here from the beach in France ;) I think it is safe to assume I made the same error in the test case as I did in the ticket and the ticket can be closed.