Details
-
Type:
Bug
-
Status: Closed
-
Priority:
High
-
Resolution: Fixed
-
Affects Version/s: Release 3.0.0
-
Fix Version/s: Release 3.1.0, 2012 Sprint 24, 2012 Sprint 24 API
-
Component/s: iOS
-
Labels:
Description
When creating a custom row that includes a button as a child, and adding a click event listener to the table, the "row" property is not being added to the click event as it bubbles up.
For some reason it seems to be added for other view types, but not for buttons.
Test case:
Ti.UI.setBackgroundColor('#000');
|
|
var win = Ti.UI.createWindow({
|
title : 'TableView Event Bubbling',
|
});
|
|
function makeRow() {
|
var row= Ti.UI.createTableViewRow({
|
backgroundColor: 'white',
|
className: 'myRowClass'
|
});
|
row.add(Ti.UI.createButton({
|
title: "My Button",
|
left: 0,
|
top: 50
|
}));
|
row.add(Ti.UI.createLabel({
|
text: Math.random().toString(36).substring(7),
|
left: 10,
|
right: 10,
|
textAlign: Ti.UI.TEXT_ALIGN_CENTER,
|
top: 0,
|
touchEnabled: true
|
}))
|
row.add(Ti.UI.createImageView({
|
image: 'KS_nav_ui.png',
|
right: 0,
|
top: 50,
|
touchEnabled: true
|
}));
|
return row;
|
}
|
var data = [];
|
for(var i = 0; i < 100; i++) {
|
data.push(makeRow());
|
}
|
|
var tbl = Ti.UI.createTableView({
|
data: data
|
});
|
tbl.addEventListener('click', function(e) {
|
Ti.API.info("e.row =" + e.row + ", e.source = " + e.source);
|
});
|
win.add(tbl);
|
win.open();
|
On 2.1.3, if I click around, I get:
[INFO] TableViewRows/1.0 (2.1.3.GA.15997d0)
|
[INFO] e.row =[object TiUITableViewRow], e.source = [object TiUIButton]
|
[INFO] e.row =[object TiUITableViewRow], e.source = [object TiUITableViewRow]
|
[INFO] e.row =[object TiUITableViewRow], e.source = [object TiUIImageView]
|
[INFO] e.row =[object TiUITableViewRow], e.source = [object TiUILabel]
|
But on 2.1.4, I get:
[INFO] TableViewRows/1.0 (3.1.0.v20121106112514.971021f)
|
[ERROR] TableViewRow structures for className myRowClass does not match
|
[ERROR] TableViewRow structures for className myRowClass does not match
|
[ERROR] TableViewRow structures for className myRowClass does not match
|
[ERROR] TableViewRow structures for className myRowClass does not match
|
[INFO] e.row =undefined, e.source = [object TiUIButton]
|
[INFO] e.row =[object TiUITableViewRow], e.source = [object TiUITableViewRow]
|
[INFO] e.row =[object TiUITableViewRow], e.source = [object TiUIImageView]
|
[INFO] e.row =[object TiUITableViewRow], e.source = [object TiUILabel]
|
So 3.0/3.1 logs an error "structures for className does not match", and the button click doesn't have a row property.