[TIMOB-8795] iOS: index, row , rowdata and section property for longpress event in tableview
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-12-21T05:42:24.000+0000 |
| Affected Version/s | Release 2.1.0, Release 2.0.1 |
| Fix Version/s | Sprint 2012-14 API, Release 3.0.0 |
| Components | iOS |
| Labels | api, module_tableview, qe-review, qe-testadded |
| Reporter | Devang Gandhi |
| Assignee | Pedro Enrique |
| Created | 2012-04-19T11:43:53.000+0000 |
| Updated | 2013-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.
HD ticket: https://support.appcelerator.com/tickets/APP-843858
Submitted [Pull Request #2336](https://github.com/appcelerator/titanium_mobile/pull/2336)
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();There is a pending pull from Pedro. Grabbing assignment as I've been working on him and I'm aware of the pull.
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)
Credit to Pedro. Pull merged.
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)?
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?
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.
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
Verified fixed in SDK 3.0.2.GA.