[TIMOB-15213] iOS ListView - events on inner children are not triggered in iOS listview
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-06-05T10:30:42.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | pantherqin |
Assignee | Unknown |
Created | 2013-08-27T06:49:37.000+0000 |
Updated | 2020-06-05T10:30:43.000+0000 |
Description
Listview template for row,
1, each row contains a view (row_view) as ChildTemplate.
2, each view (row_view) is set "event : { click : row_click }"
3, each view (row_view) contains a view (sw_view) as ChildTemplate
4, each view (sw_view) contains 2 ImageView as ChildTemplate
ONLY when I click on row_view, the function row_click is triggered.
When I click on sw_view, the function row_click is NOT triggered.
When I click on the innermost ImageViews, the function row_click is NOT triggered.
In Android, click on any of the components will trigger row_click function.
var _templates = {};
var _section_count = 10;
var _listview_w = Ti.UI.FILL;
var fixTemplate = {
properties : {
accessoryType : Ti.UI.LIST_ACCESSORY_TYPE_NONE,
selectionStyle : Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE,
width : _listview_w,
height : 50,
backgroundColor : '#0000FF',
},
childTemplates : [
{
type : 'Ti.UI.View',
bindId : 'row_view',
properties : {
width : _listview_w,
height : 48,
right : 0,
backgroundColor : '#CCCCCC',
backgroundSelectedColor : '#dff0ff',
},
events: {
click : row_click
},
childTemplates : [
{
type : 'Ti.UI.View',
bindId : 'sw_view',
properties : {
width : 48,
height : 48,
right : 0,
backgroundColor : '#666666',
backgroundSelectedColor : '#dff0ff',
},
childTemplates : [
{
type : 'Ti.UI.ImageView',
bindId : 'sw_right_off',
properties : {
image : '/images/button_select_up.png',
backgroundColor : 'transparent',
visible : false,
}
},
{
type : 'Ti.UI.ImageView',
bindId : 'sw_right_on',
properties : {
image : '/images/button_select_down.png',
backgroundColor : 'transparent',
visible : false,
}
}
]
}
]
}
]
}
_templates["fixTemplate"] = fixTemplate;
function row_click(e) {
Ti.API.debug("--------------------------------------------------------------------- : " + e.type + ", " + e.bindId);
}
var _sections = [];
var _data = [];
for (var i = 0; i < _section_count; i++) {
_data.push({
template : "fixTemplate",
});
}
var section = Ti.UI.createListSection({
items : _data,
});
_sections.push(section);
var win = Ti.UI.createWindow({backgroundColor: '#F0F0F0'});
var listView = Ti.UI.createListView({
templates : _templates,
defaultItemTemplate : 'fixTemplate',
properties : {
width : 300,
}
});
listView.sections = _sections;
win.add(listView);
win.open();
Any news on this? I am also experiencing this issue.
Closing because this is expected behaviour. You have to monitor
itemclick
on the listview and determine what was clicked based onbindId