GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-12-12T23:12:54.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.0.0, Release 3.1.0, 2012 Sprint 21 API, 2012 Sprint 21, 2012 Sprint 25 API |
Components | Android |
Labels | SupportTeam, api, module_tableview, qe-testadded, triage |
Reporter | Davide Cassenti |
Assignee | Karl Rowley |
Created | 2012-10-10T10:54:44.000+0000 |
Updated | 2013-09-26T07:35:46.000+0000 |
Problem description
When a TableViewSection has many rows (~30 or more), the title of the first section is repeated for the other ones. When the rows are few, this doesn't happen.
Steps to reproduce
- Use the following sample to reproduce the issue:
var win1 = Titanium.UI.createWindow({
title : 'Window',
left : 0,
top : 0,
backgroundColor : '#FFF'
});
win1.open();
// section 1
var headerView1 = Ti.UI.createView({
height:35,
backgroundColor:'#64A5DB',
opacity:0.8
});
headerView1.add(Ti.UI.createLabel({
left:10,
height:35,
width:Ti.UI.SIZE,
text: "Classes",
ellipsize:true,
color:'white',
font:{
fontSize:15,
fontWeight:'bold'
}
}));
var section1 = Ti.UI.createTableViewSection({
headerView: headerView1
});
for(var i=0; i<30; i++) {
section1.add(Ti.UI.createTableViewRow({title: "Section 1 - Row " + (i+1)}));
}
// 2nd section
var headerView2 = Ti.UI.createView({
height:35,
backgroundColor:'#64A5DB',
opacity:0.8
});
headerView2.add(Ti.UI.createLabel({
left:10,
height:35,
width:Ti.UI.SIZE,
text: "Topics",
ellipsize:true,
color:'white',
font:{
fontSize:15,
fontWeight:'bold'
}
}));
var section2 = Ti.UI.createTableViewSection({
headerView: headerView2
});
for(var i=0; i<30; i++) {
section2.add(Ti.UI.createTableViewRow({title: "Section 2 - Row " + (i+1)}));
}
var tableview = Ti.UI.createTableView({
data: [section1, section2]
});
win1.add(tableview);
- Run the app: note how the section 2 header says 'Classes' and not 'Topics'.
- Change the number of rows from 30 to 3 and repeat: now everything is fine.
Note
Works fine on iOS
I've tried to reproduce this and haven't been able to. Are you sure that you are using a recent 3.0.X SDK? You need to make sure that the SDK you are using includes the change for TIMOB-10458.
Maybe related to TIMOB-10712. Cannot reproduce this issue with latest 3_0_X and master.
i see this in 2.1.3 as well
This has been tested in 3.1 and seems to be fixed, but when rotated into landscape, it appears again. Will provide more information shortly.
Not sure if I should add this here, or create a new issue? Anyway, here it is. There seems to be a related bug where the headerView element gets shuffled when scrolling. Try the example code below. It should have headers Red, Green, Purple, Purple. In 2.1.4, the titles get skewed (eg Red, Green, Purple, Red) with the same background colours. In 3.0.0.v20121207120202, the titles are correct, however the background colours still skew. So text Red, Green, Purple, Purple, but colours red, green, purple, red.
OK, TableView drives the view to proxy association through getView(), which turns the associations into a rats nest. I'll be submitting a PR shortly.
Pull request https://github.com/appcelerator/titanium_mobile/pull/3561
Here's an expansion of the test case shown above with more sections for testing:
Pull request https://github.com/appcelerator/titanium_mobile/pull/3566 for backport to 3_0_X
Verified with Android 2.3.6 and Android 4.1. Titanium SDK:3.0.0.v20121210171701 Titanium Studio:3.0.0.201212071410
Reopening to add fixVersion