Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7916] Android: TableViewSection - For-loop counter does not increment properly when added to a TableViewSection

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-13T17:41:45.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 3.0.2
ComponentsAndroid
Labelsqe-nfc, triage
ReporterWilson Luu
AssigneeShameer Jan
Created2012-03-07T12:50:59.000+0000
Updated2017-03-21T21:32:10.000+0000

Description

Steps to reproduce: 1. Run the following app.js on Android:
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var tableView = Ti.UI.createTableView();

var data = [];

for (var c=0;c<4;c++)
{
	var label = Ti.UI.createLabel({
		text:'Header ' + (c+1),
		color:'black',
		width:'auto',
		height: 'auto',
		left:4
	});
	
	var pinkHeader = Ti.UI.createView({backgroundColor: 'pink', height: 40});
	pinkHeader.add(label);
	
	data[c] = Ti.UI.createTableViewSection({
		headerView: pinkHeader
	});
	for (var x=0;x<10;x++)
	{
		data[c].add(Ti.UI.createTableViewRow({title:'Group '+(c+1)+', Row '+(x+1)}));
	}
}

tableView.data = data;

win.add(tableView);
win.open();
*Actual:* Notice pink headers are not incrementing properly. Displaying Header 1, Header 2, Header 1, Header 2 *Expected:* Should display Header 1, Header 2, Header3, Header 4 2. Scroll to the bottom of the table then back up a couple of times *Actual:* Headers displays Header 2, Header 1, Header 2, Header 1 *Expected:* Headers should stay Header 1, Header 2, Header 3, Header 4 *Note:* * The above code works fine on iOS using SDK build 2.0.0.v20120307114708 * Was not able to test for regression in 1.8.2 because of bug TIMOB-3435

Comments

  1. Justin Toth 2012-11-14

    This is still an issue and it would be great if it could get some attention. Here is another reproduction case using a view instead of a label for the headerView.
       var data = [];
       
       for (var i = 0; i < 50; i++) {    
           if (i % 10 == 0) {
           	var headerView = Ti.UI.createView({ height: 50, backgroundColor: "#808080", className: "headerView" + i });
               var headerLabel = Ti.UI.createLabel({
                   text: 'header ' + i,
                   font: { fontSize: 24, color: "#000" },
                   className: "headerLabel" + i
               })
               headerView.add(headerLabel);
               var section = Ti.UI.createTableViewSection({
                   headerView: headerView,
                   className: "headerSection" + i
               });
               data.push(section);
           }
           var row = Ti.UI.createTableViewRow({
               title: 'row ' + i
           });
           section.add(row);
       }
       
       var table = Ti.UI.createTableView({
           data: data
       });
       
       var window = Titanium.UI.createWindow({
           backgroundColor: 'white'
       });
       
       window.add(table);
       window.open();
       
  2. Shameer Jan 2013-03-13

    The issue cannot reproduce with the release 3.0.2 and 3.1.0
  3. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced.

JSON Source