Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16219] iOS: Clicking a label in first row of table view is not working

GitHub Issuen/a
TypeBug
Priorityn/a
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterMurali Rama
AssigneeUnknown
Created2013-10-08T06:25:11.000+0000
Updated2018-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

FileDateSize
app.js2013-10-17T05:11:56.000+00002729

Comments

  1. David He 2013-10-08

    Please provide the minimal code that can recreate this issue.
  2. Murali Rama 2013-10-09

    I am simulating this problem on minimal code. I will update them in few days.
  3. Murali Rama 2013-10-13

    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]
  4. Murali Rama 2013-10-16

    Hello, Is there any update on this JIRA ticket?
  5. Mauro Parra-Miranda 2013-10-16

    Hello, please provide a testcase for this. I tested the one in your comment, and is not even compiling. Best, Mauro
  6. Murali Rama 2013-10-17

    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]
  7. Mostafizur Rahman 2014-01-02

    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.3
  8. Murali Rama 2014-01-07

    Hello, 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]

JSON Source