[TIMOB-2719] TableViewRows containing multiple views & having the same className exhibit weird behaviour
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:59:54.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M05 |
Components | Android |
Labels | android, defect, release-1.6.0 |
Reporter | Taazza |
Assignee | Marshall Culpepper |
Created | 2011-04-15T03:27:43.000+0000 |
Updated | 2011-04-17T01:59:54.000+0000 |
Description
See https://gist.github.com/ab80b6d74e1559bdb7f5">https://gist.github.com/ab80b6d74e1559bdb7f5 for example app on Titanium 1.5.1 (tested on Android 1.6 & 2.2).
We create a simple TableView, add it to a window & open the window. Now in a loop, we add 15 rows to the TableView with each row having the same className 'item'. Each row contains a view with 2 different Labels added to it. We use appendRow to add rows to the TableView. Expected behaviour is that the rows will be in order from 1 to 15. However we see that the rows containing odd & even numbers are grouped together on either side of the row containing item 0!
Each row also has an event handler which will alert the row number. Again, this seems to work in a weird way. There seems to be no correspondence between the row number displayed in the label & the number displayed in the alert box! Sometimes a few rows in the beginning show correlation, but this breaks as soon as we start scrolling.
However, using unique class names for each row seems to fix this problem. But that is supposed to be inefficient & isn't recommended by the documentation. Also Bug 2621 (https://appcelerator.lighthouseapp.com/projects/32238/tickets/2621-android-app-crashes-with-paged-tableview-15x-regression">https://appcelerator.lighthouseapp.com/projects/32238/tickets/2621-...) occurs occasionally when we use unique class names.
We tried pushing the rows into an array and using setData to update the TableView. This doesn't exhibit the initial odd/even grouping of rows. But as soon as we start scrolling, the rows get totally scrambled and the alerts begin exhibiting the behaviour detailed above.
In both these cases, if we change the device orientation then some rows disappear altogether! The alerts on them continue to work though.
Attachments
File | Date | Size |
---|---|---|
app.apk | 2011-04-15T03:27:44.000+0000 | 1231749 |
testtar.gz | 2011-04-15T03:27:45.000+0000 | 121397 |
I am attaching a test apk built using Titanium 1.5.1 on Android 2.2 which reproduces the weird behaviour seen while using appendRow. The code used can be found in the gist mentioned earlier (https://gist.github.com/ab80b6d74e1559bdb7f5)">https://gist.github.com/ab80b6d74e1559bdb7f5).
For the sake of completeness, I am attaching the test project used to build the test apk.
seeing same problem in 1.6 build http://developer.appcelerator.com/question/97621/more-tableviewrow-android-issues"> http://developer.appcelerator.com/question/97621/more-tableviewrow-...
(from [7c4e9b3d7822dd742549caa224a8b7d944e279b6]) recursively set view proxies on TiUIViews when reusing Views inside a TableView [#2719 state:fixed-in-qa]
https://github.com/appcelerator/titanium_mobile/commit/7c4e9b3d7822dd742549caa224a8b7d944e279b6"> https://github.com/appcelerator/titanium_mobile/commit/7c4e9b3d7822...
Verified on G1/1.6 and Nexus One/2.2.1 using build #e1cb22a