Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15540] iOS7: TableView singletap and doubletap events do not provide row information

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-01-07T18:26:47.000+0000
Affected Version/sRelease 3.1.3
Fix Version/s2013 Sprint 22, 2013 Sprint 22 API, Release 3.2.0
ComponentsiOS
LabelsSupportTeam, module_tableview, qe-testadded, triage
ReporterRudolf Cardinal
AssigneeVishal Duggal
Created2013-10-15T08:17:32.000+0000
Updated2014-02-12T10:35:21.000+0000

Description

Problem Description

The source of events like click, singletap, are not being reported. Instead, you get random internal information.

Steps to Reproduce

1. Create new mobile project with 3.1.3 in iOS 2. Paste the testcase to app.js 3. Run the app, click on the row. 4. You will see the source.

Testcase

var rowdata = [
{title: 'row_0'},
{title: 'row_1'},
{title: 'row_2'},
];
var win = Ti.UI.createWindow( { backgroundColor: '#FFFFFF' } );
var table = Ti.UI.createTableView( { data: rowdata } );

// Either:

table.addEventListener('singletap', eventArrived);
//table.addEventListener('doubletap', eventArrived);

// Or:

//table.addEventListener('click', eventArrived);

win.add(table);
win.open();

function eventArrived(e) {
alert('Event from table: ' + JSON.stringify(e));
}

Extra info

With singletap and doubletap events, the event contains no row information: [TRACE] : Event from table: {'x':222,'y':31,'bubbles':true,'type':'singletap','source':{'hideSearchOnSelection':true,'horizontalWrap':true,'searchHidden':false},'cancelBubble':false} [TRACE] : Event from table: {'x':91,'y':61,'bubbles':true,'type':'singletap','source':{'hideSearchOnSelection':true,'horizontalWrap':true,'searchHidden':false},'cancelBubble':false} [TRACE] : Event from table: {'x':145,'y':101,'bubbles':true,'type':'singletap','source':{'hideSearchOnSelection':true,'horizontalWrap':true,'searchHidden':false},'cancelBubble':false} [TRACE] : Event from table: {'x':137,'y':22,'bubbles':true,'type':'doubletap','source':{'hideSearchOnSelection':true,'horizontalWrap':true,'searchHidden':false},'cancelBubble':false} [TRACE] : Event from table: {'x':130,'y':73,'bubbles':true,'type':'doubletap','source':{'hideSearchOnSelection':true,'horizontalWrap':true,'searchHidden':false},'cancelBubble':false} [TRACE] : Event from table: {'x':129,'y':100,'bubbles':true,'type':'doubletap','source':{'hideSearchOnSelection':true,'horizontalWrap':true,'searchHidden':false},'cancelBubble':false} With click events, the event object correctly contains row information: [TRACE] : Event from table: {'x':122,'section':{'horizontalWrap':true},'row':{'horizontalWrap':true,'title':'row_0'},'index':0,'y':36,'rowData':{'horizontalWrap':true,'title':'row_0'},'searchMode':false,'detail':false,'bubbles':true,'type':'click','source':{'horizontalWrap':true,'title':'row_0'},'cancelBubble':false} [TRACE] : Event from table: {'x':135,'section':{'horizontalWrap':true},'row':{'horizontalWrap':true,'title':'row_1'},'index':1,'y':9,'rowData':{'horizontalWrap':true,'title':'row_1'},'searchMode':false,'detail':false,'bubbles':true,'type':'click','source':{'horizontalWrap':true,'title':'row_1'},'cancelBubble':false} [TRACE] : Event from table: {'x':166,'section':{'horizontalWrap':true},'row':{'horizontalWrap':true,'title':'row_2'},'index':2,'y':23,'rowData':{'horizontalWrap':true,'title':'row_2'},'searchMode':false,'detail':false,'bubbles':true,'type':'click','source':{'horizontalWrap':true,'title':'row_2'},'cancelBubble':false}

Expected Result

Row information from singletap, doubletap, and click events (as per current API documentation).

Attachments

FileDateSize
.log2013-10-15T08:17:36.000+00001355063
bugtest_table_events.js2013-10-15T08:17:40.000+00002878
diagnostic7873121913403312023.log2013-10-15T08:17:40.000+000013624

Comments

  1. Jason Kotchoff 2013-10-21

    This is critical priority for us. Our app needs to use singletap listeners (instead of click listeners) on our table rows and this bug makes that functionality inoperable. Interestingly, you will note that when the tablerow has elements stacked on top of it, tapping those elements does indeed fire the event with row information. As such, a potential temporary workaround until Appcelerator fix this is to create a full-width transparent view on the table row and then use a custom label instead of a 'title' attribute when building the table row. eg. var row = Ti.UI.createTableViewRow({hasChild: true, height: 44}); // This view ensures that when the row is tapped, the event that is fired contains a 'row' property. Assumedly, you would build this with a transparent background. row.add(Ti.UI.createView({width: '100%', height: 44, backgroundColor: 'yellow'})); // If the view above is not present, tapping this element fires the event with the row property. Tapping elsewhere on the row fires the event without the row property. row.add(Ti.UI.createLabel({ text : 'row_x', left: 7, width: 100, backgroundColor: 'gray' })); var rowdata = [ row ]; ... Note: this workaround still doesn't include the row property in the event if the 'hasChild' arrow is tapped.
  2. Ingo Muschenetz 2013-10-21

    Thank you for the report. We will discuss this for inclusion in the next release.
  3. Vishal Duggal 2013-10-30

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/4891
  4. Murali Rama 2013-11-07

    Hi Vishal, When will TI SDK update available with this fix? Thanks.
  5. Ingo Muschenetz 2013-11-07

    [~muralinr] Version 3.2.0 as noted in the "Fix Version" field. Likely early December.
  6. Pragya Rastogi 2013-11-14

    Tested and verified the fix with: OSX: 10.8.5 Xcode:5.0 Appcelerator Studio: 3.2.0.201311122338 SDK: 3.2.0.v20131113183932 acs:1.0.7 alloy:1.3.0 npm:1.3.2 titanium:3.2.0 titanium-code-processo:1.0.3 Device: iOS7(v7.0.3)-iPodTouch1
  7. Murali Rama 2013-12-31

    I still see this issue on TI SDK 3.2.0 version. When will this issue be fixed and released? Thanks.
  8. Ingo Muschenetz 2013-12-31

    If you still see this issue, please provide a test case that demonstrates it. There may be an edge case we missed.
  9. Murali Rama 2014-01-01

    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]
  10. Murali Rama 2014-01-07

    Hello, Is there any update on above test code? When will this issue be fixed? Thanks.
  11. Ingo Muschenetz 2014-01-07

    Reopening based on comments
  12. Sabil Rahim 2014-01-07

  13. Priya Agarwal 2014-01-21

    Appc Studio:3.2.1.201401151647 Sdk:3.2.1.v20140117222448 alloy:1.3.1-beta2 titanium:3.2.1(from cli) acs:1.0.11 titanium-code-processor:1.1.0 Osx: Maverick 10.9 Xcode:5.0.2 Device:iPhone5c(v7.0.4) SingleTap and DoubleTap working for tableView. Hence Closing the issue.

JSON Source