[TIMOB-12886] table view click event gets fired twice on second navigation when used with tab group.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2017-06-19T17:53:45.000+0000 |
Affected Version/s | Release 3.0.0, Release 3.0.1, Release 3.0.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Ashish Nigam |
Assignee | Eric Merriman |
Created | 2013-02-27T06:46:01.000+0000 |
Updated | 2017-06-19T17:53:45.000+0000 |
Description
Table view click event gets fired twice on second navigation when used with tab group.
**Steps to reproduce**
1: Delete other code from app.js copy paste code below code in app.js.
2: run the app in iPad or iPhone Simulator.
3: click on win open button, it will open another window with table view and labels added to its rows.
4: now if click on row or label, table view click event fired once only.
now
5: Go back, and click on win button again.
6: now when you click on row, table view click event fired once but if you click on label then table view click event fired twice.
7: so on 1st time event fired once but from 2nd time onwards, it fires 2 times.
var tabgr = Ti.UI.createTabGroup();
var win = Ti.UI.createWindow({
backgroundColor:"green"
});
var win1 = Ti.UI.createWindow({
backgroundColor:"green"
});
var button = Ti.UI.createButton({
top:100,
left:100,
height:150,
width:150,
title:"win open"
});
button.addEventListener("click",function(){
win.attachedab.open(win1);
});
win.add(button);
var tab1 = Ti.UI.createTab({
title:"tab",
window:win
});
win.attachedab = tab1;
// Create a TableView.
var mytable = Ti.UI.createTableView();
// Populate the TableView data.
var data = [
{title:'Row 1', hasChild:true, color:'red', header:'First'},
{title:'Row 2', hasDetail:true, color:'green'},
{title:'Row 3', hasCheck:true, color:'blue', header:'Second'},
{title:'Row 4', color:'orange'}
];
var dataRows = [];
var row1 = Ti.UI.createTableViewRow({
height:"150dp"
});
var row2 = Ti.UI.createTableViewRow({
height:"150dp"
});
var row3 = Ti.UI.createTableViewRow({
height:"150dp"
});
var row4 = Ti.UI.createTableViewRow({
height:"150dp"
});
// Create a Label.
var mylable = Ti.UI.createLabel({
text : 'mylable for testign',
color : "#C0C0C0",
font : {fontSize:20},
height : 150,
width : 150,
top : 2,
left : 2,
textAlign : 'center'
});
var mylable1 = Ti.UI.createLabel({
text : 'mylable for testign',
color : "#C0C0C0",
font : {fontSize:20},
height : 150,
width : 150,
top : 2,
left : 2,
textAlign : 'center'
});
var mylable2 = Ti.UI.createLabel({
text : 'mylable for testign',
color : "#C0C0C0",
font : {fontSize:20},
height : 150,
width : 150,
top : 2,
left : 2,
textAlign : 'center'
});
var mylable3 = Ti.UI.createLabel({
text : 'mylable for testign',
color : "#C0C0C0",
font : {fontSize:20},
height : 150,
width : 150,
top : 2,
left : 2,
textAlign : 'center'
});
// Add to the parent view.
row1.add(mylable);
row2.add(mylable1);
row3.add(mylable2);
row4.add(mylable3);
dataRows.push(row1,row2,row3,row4);
mytable.setData(dataRows);
// Listen for click events.
mytable.addEventListener('click', function(e) {
alert('title: \'' + e.row.title + '\', section: \'' + e.section.headerTitle + '\', index: ' + e.index);
});
// Add to the parent view.
win1.add(mytable);
tabgr.addTab(tab1);
tabgr.open();
I am unable to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170609091155 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131