[TIMOB-9973] iOS: Incorrect properties returned by TableView's longpress event.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-08-13T09:45:12.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Sprint 2012-15 API, Release 3.0.0 |
Components | iOS |
Labels | api, module_tableview, parity, qe-testadded |
Reporter | Hieu Pham |
Assignee | Vishal Duggal |
Created | 2012-07-16T15:05:21.000+0000 |
Updated | 2012-12-27T18:41:43.000+0000 |
Description
Steps to reproduce:
1. Run this 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);
if(e.row)
{
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();
2. Perform a long press on multiple sections. You will see:
[INFO] Section: [object TiUITableViewSection]
[INFO] Row: [object TiUITableViewRow]
[INFO] Row Data: [object TiUITableViewRow]
[INFO] Index: 0
[INFO] customProp: Hello World! #0
printed for each and every section, which is inccorect. Row and all its data should be null if longpress is performed on a table section.
Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/2597
Ok so here is an example that shows how slow it gets. - it s already not so smooth on 2.1.0.GA but still very "scrollable" - it s drastically slower on 2.2.0 (master) - you wont see it on simulator!!! the problem appears on device (mine is an iphone 4).
Tested with Titanium SDK: 2.2.0.v20120808154112 Tested with Titanium Studio: 2.1.1.201207271312 On LongPress of Section header, exception is thrown in the logs as follows: [INFO] Section: [object TiUITableViewSection] [INFO] Row: undefined [INFO] Row Data: undefined [INFO] Index: undefined [WARN] Exception in event callback. { line = 27; message = "'undefined' is not an object (evaluating 'e.rowData.customProp')"; name = TypeError; sourceId = 252762528; sourceURL = "file://localhost/Users/nehachhabra/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/65094C8E-EFE7-4EBF-BE85-939A31265761/Test.app/app.js"; }
The test case is incorrect. Have updated the test case
Verified fixed with: Titanium Studio, build: 2.1.1.201207271312 SDK version: 2.2.0.v20120816015712 Devices: iPad3 4G (5.1.1) iPhone4s (5.0.1)