[TIMOB-16219] iOS: Clicking a label in first row of table view is not working
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Murali Rama |
Assignee | Unknown |
Created | 2013-10-08T06:25:11.000+0000 |
Updated | 2018-02-28T20:03:47.000+0000 |
Description
When I press a label in first row of table view, it is returning [object TiUITableViewRow] instead of [object TiUILabel]. All other rows, it is returning correct label [object TiUILabel]. What could be a reason for this issue happening for only first row? This issue happens only with 3.1.3GA version when I compiled for iPhone/iPad.
Attachments
File | Date | Size |
app.js | 2013-10-17T05:11:56.000+0000 | 2729 |
Please provide the minimal code that can recreate this issue.
I am simulating this problem on minimal code. I will update them in few days.
Hello David, Here is minimal code to reproduce this issue. Ti.UI.setBackgroundColor('#000'); var win = Ti.UI.createWindow({ title : 'TableView Bug', }); function makeRow () { var row = Ti.UI.createTableViewRow({ //backgroundColor:'transparent', selectionStyle: Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE, objName: 'row', height:45 }); var primaryLabelwidth = 160; var primaryLabel = Ti.UI.createLabel({ text:"label1", top:0, left:15, height:30, width:primaryLabelwidth, //For iPhone vs. iPad (in Portrait) color:'#ffffff', elementName: 'primaryLabel', touchenabled: false, //font:{fontSize:16,fontWeight:'bold', fontFamily:'Chalkduster'} font:{fontSize:16,fontWeight:'bold', fontFamily:'Helvetica Neue'} }); row.add(primaryLabel); //This is how you add the quantity var quantityLabel = Ti.UI.createLabel({ text:"1", top:0, right:91, height:40, width:20, //borderColor:'#ffffff', textAlign: Ti.UI.TEXT_ALIGNMENT_RIGHT, //Height width both needed for proper triggering color:'#ffffff', elementName: 'Quantity', //touchenabled: false, font:{fontSize:11,fontWeight:'normal', fontStyle: 'italic', fontFamily:'Helvetica Neue'} }); row.add(quantityLabel); var unitsLabel = Ti.UI.createLabel({ text:"YY", top:0, right:49, height:40, width:42, //borderColor:'#ffffff', textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT, color:'#ffffff', elementName: 'Units', //touchenabled: false, font:{fontSize:11,fontWeight:'normal', fontStyle: 'italic', fontFamily:'Helvetica Neue'} }); row.add(unitsLabel); return row; } var table1 = Ti.UI.createTableView({ top:60, left:0, right:20, bottom:40, style: Ti.UI.iPhone.TableViewStyle.PLAIN, separatorStyle: Titanium.UI.iPhone.TableViewSeparatorStyle.NONE, separatorColor: 'transparent', backgroundColor: 'transparent', borderColor:'#e5e5e5', borderRadius:10, borderWidth: 0.5, editable:true, // 'swipe to delete' on iPhone is the default if you set editable:true in the createTableview command. moveable:true, longpressIsActive: false, objectName: 'table', visible: true }); var refreshItemnames = function(){ var test_index = 0; Ti.API.info('Reached: '); while (test_index < 5) { row = makeRow (); //Shopping list name added to the master table of shopping lists as a specific row table1.appendRow (row); test_index = test_index + 1; } Ti.API.info('while loop ended: '); }; refreshItemnames(); table1.addEventListener('click', function(e) { Ti.API.info("e.row =" + e.row + ", e.source = " + e.source); }); win.add(table1); win.open(); Problem when first row is clicked (It shows output as follows): [INFO] e.row =[object TiUITableViewRow], e.source = [object TiUITableViewRow] Second row or any other row clicked (It shows output as follows): [INFO] e.row =[object TiUITableViewRow], e.source = [object TiUILabel]
Hello, Is there any update on this JIRA ticket?
Hello, please provide a testcase for this. I tested the one in your comment, and is not even compiling. Best, Mauro
Below code is compiling fine on 3.1.3GA version for iPad/iPhone. Please do not close this issue without resolving it. test case (copy below code to app.js): Ti.UI.setBackgroundColor('#000'); var win = Ti.UI.createWindow({ title : 'TableView Bug', }); function makeRow () { var row = Ti.UI.createTableViewRow({ //backgroundColor:'transparent', selectionStyle: Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE, objName: 'row', height:45 }); var primaryLabelwidth = 160; var primaryLabel = Ti.UI.createLabel({ text:"label1", top:0, left:15, height:30, width:primaryLabelwidth, //For iPhone vs. iPad (in Portrait) color:'#ffffff', elementName: 'primaryLabel', touchenabled: false, //font:{fontSize:16,fontWeight:'bold', fontFamily:'Chalkduster'} font:{fontSize:16,fontWeight:'bold', fontFamily:'Helvetica Neue'} }); row.add(primaryLabel); //This is how you add the quantity var quantityLabel = Ti.UI.createLabel({ text:"1", top:0, right:91, height:40, width:20, //borderColor:'#ffffff', textAlign: Ti.UI.TEXT_ALIGNMENT_RIGHT, //Height width both needed for proper triggering color:'#ffffff', elementName: 'Quantity', //touchenabled: false, font:{fontSize:11,fontWeight:'normal', fontStyle: 'italic', fontFamily:'Helvetica Neue'} }); row.add(quantityLabel); var unitsLabel = Ti.UI.createLabel({ text:"YY", top:0, right:49, height:40, width:42, //borderColor:'#ffffff', textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT, color:'#ffffff', elementName: 'Units', //touchenabled: false, font:{fontSize:11,fontWeight:'normal', fontStyle: 'italic', fontFamily:'Helvetica Neue'} }); row.add(unitsLabel); return row; } var table1 = Ti.UI.createTableView({ top:60, left:0, right:20, bottom:40, style: Ti.UI.iPhone.TableViewStyle.PLAIN, separatorStyle: Titanium.UI.iPhone.TableViewSeparatorStyle.NONE, separatorColor: 'transparent', backgroundColor: 'transparent', borderColor:'#e5e5e5', borderRadius:10, borderWidth: 0.5, editable:true, // 'swipe to delete' on iPhone is the default if you set editable:true in the createTableview command. moveable:true, longpressIsActive: false, objectName: 'table', visible: true }); var refreshItemnames = function(){ var test_index = 0; Ti.API.info('Reached: '); while (test_index < 5) { row = makeRow (); //Shopping list name added to the master table of shopping lists as a specific row table1.appendRow (row); test_index = test_index + 1; } Ti.API.info('while loop ended: '); }; refreshItemnames(); table1.addEventListener('click', function(e) { Ti.API.info("e.row =" + e.row + ", e.source = " + e.source); }); win.add(table1); win.open(); Log output :Problem when "1YY" label in first row is clicked (It shows output as follows): [INFO] e.row =[object TiUITableViewRow], e.source = [object TiUITableViewRow] Log output when "1YY" label in Second row or any other row clicked (It shows output as follows): [INFO] e.row =[object TiUITableViewRow], e.source = [object TiUILabel]
Hello, We tested this this issue with the code you posted. We can’t reproduce this issue. It’s working fine for me. Its most likely fixed. Please check this code with the latest TiSDK build (TiSDK 3.2.0) and let me know if this problem persists.
Test Environment
Mac OS X 10.8.5 Ti SDK 3.2.0.GA Ti CLI 3.2.0 IOS 7.0.3Hello, I still see this issue with below test code. Here is test case (app.js) and steps to reproduce this issue: Ti.UI.setBackgroundColor('#000'); var win = Ti.UI.createWindow({ title : 'TableView Bug', }); function makeRow () { var row = Ti.UI.createTableViewRow({ //objName: 'row', height:45 }); var primaryLabelwidth = 160; var primaryLabel = Ti.UI.createLabel({ text:"label1", top:0, left:15, height:30 }); row.add(primaryLabel); var unitsLabel = Ti.UI.createLabel({ text:"YY", top:0, right:49, height:40, width:42 }); row.add(unitsLabel); return row; } var table1 = Ti.UI.createTableView({ top:60, left:0, right:20, bottom:40, editable:true, // 'swipe to delete' on iPhone is the default if you set editable:true in the createTableview command. moveable:true, longpressIsActive: false, objectName: 'table', visible: true }); var refreshTableItems = function(){ var test_index = 0; Ti.API.info('Reached: '); while (test_index < 5) { row = makeRow (); //Shopping list name added to the master table of shopping lists as a specific row table1.appendRow (row); test_index = test_index + 1; } Ti.API.info('while loop ended: '); }; refreshTableItems(); table1.addEventListener('click', function(e) { Ti.API.info("e.row =" + e.row + ", e.source = " + e.source); }); win.add(table1); win.open(); Steps to reproduce this issue: 1. Create a new mobile project for iOS7, with 3.2.0.GA 2. Paste the testcase into app.js 3. Run in the simulator 4. Click on the first row. 5. Click on the second row. 6. Check console, you will see the difference, even if you created the two rows in the same way. Log file when YY label is clicked in TableView: First row output: [INFO] e.row =[object TiUITableViewRow], e.source = [object TiUITableViewRow] Second or any other row is clicked: [INFO] e.row =[object TiUITableViewRow], e.source = [object TiUILabel]