Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8795] iOS: index, row , rowdata and section property for longpress event in tableview

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-12-21T05:42:24.000+0000
Affected Version/sRelease 2.1.0, Release 2.0.1
Fix Version/sSprint 2012-14 API, Release 3.0.0
ComponentsiOS
Labelsapi, module_tableview, qe-review, qe-testadded
ReporterDevang Gandhi
AssigneePedro Enrique
Created2012-04-19T11:43:53.000+0000
Updated2013-03-11T20:42:32.000+0000

Description

Just like the click event in TI.UI.Tableview, customer wants index,row,rowdata and section property for longpress event.

Comments

  1. Shawn Lipscomb 2012-04-19

    HD ticket: https://support.appcelerator.com/tickets/APP-843858
  2. Pedro Enrique 2012-06-05

    Submitted [Pull Request #2336](https://github.com/appcelerator/titanium_mobile/pull/2336)
  3. Pedro Enrique 2012-06-05

    Test code:
       var win = Ti.UI.createWindow();
       
       var tableData = []
       var s = 0;
       var nRow = 0;
       for(var i = 0; i < 100; i++){
       	var createNewSection = (i + 1) % 10 == 9 || i == 0 ? true : false;
       	createNewSection ? nRow = 1 : nRow++;
       	tableData.push({
       		title:'Row #' + nRow + ' Index #' + i + ' Section #' + s,
       		customProp:'Hello World! #' + i,
       		header: createNewSection ? 'Section #' + s++ : null
       	});
       }
       
       var table = Ti.UI.createTableView({
       	data: tableData
       });
       
       win.add(table);
       
       table.addEventListener('longpress', function(e){
       	Ti.API.info('Section:    ' + e.section);
       	Ti.API.info('Row:        ' + e.row);
       	Ti.API.info('Row Data:   ' + e.rowData);
       	Ti.API.info('Index:      ' + e.index);
       	Ti.API.info('customProp: ' + e.rowData.customProp);
       });
       
       win.open();
       
  4. Blain Hamon 2012-06-21

    There is a pending pull from Pedro. Grabbing assignment as I've been working on him and I'm aware of the pull.
  5. colin boettcher 2012-07-05

    Modified current 2.1.0.GA framework with Pedro's code. Works like a Charm. I would appreciate if this Ticket gets into 2.2 / 2.1.x This solution is far better then calculating the cell manually like Math.floor((e.y + offset.y)/rowHeight)
  6. Blain Hamon 2012-07-09

    Credit to Pedro. Pull merged.
  7. Shawn Lipscomb 2012-07-10

    Will this fix be in 2.1.1.vxxxxxx or 2.2.0.vxxxxxxxx (Fix Version says "Sprint 2012-14 API", but I have no idea what that means)?
  8. Shawn Lipscomb 2012-07-12

    I see that "Release 2.2.0" has been added to the Fix Version on this ticket. Any chance it can be merged into 2.1.1.vxxxxxx as well?
  9. Shawn Lipscomb 2012-08-01

    I guess not, since I just tried it with 2.1.1.GA and still don't get index, row, rowdata or section properties on the longpress event.
  10. Shyam Bhadauria 2012-08-16

    Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120815194913 Tested with Titanium  Studio: 2.1.1.201207271312 Device - iOS 5.1 simulator Machine OS - MAC 10.7.3
  11. Shawn Lipscomb 2013-03-11

    Verified fixed in SDK 3.0.2.GA.

JSON Source