Skip to content

Android: TableView show/hide causes issues for rows outside of the view #14316

@m1ga

Description

@m1ga

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

If you run the example code it will genearte 50 rows: 1 with a show/hide button and the rest with textfields. If you click on the show/hide button it will set all rows to height:0 and visible:false. If you click on the button again it will show you the rows again but only the rows that are visible in the view port (+ the first few others)

Start:

Image

After hiding:

Image

After showing and scrolling down:

Image (missing rows)

In Android Studio I can pick the hidden row and select the TiCompositeLayout and see that is still set to GONE:

Image

while the other views are set to visible.

Expected Behavior

all rows show be visible again.

Actual behavior

rows hidden

Reproducible sample

var win = Ti.UI.createWindow();
var tblSection = Ti.UI.createTableViewSection({
	headerTitle: 'test'
});

var rows = [];
var isVisible = true;
for (var i = 0; i < 50; ++i) {
	var row = Ti.UI.createTableViewRow({
		height: 50,
		hiddenBehavior: Titanium.UI.HIDDEN_BEHAVIOR_GONE
	})
	if (i == 0) {
		var btn = Ti.UI.createButton({
			title: 'hide/show'
		});
		row.add(btn)
	} else {
		var lbl = Ti.UI.createTextField({
			value: "test" + i,
		});
		row.add(lbl)
	}
	tblSection.add(row);
	if (i == 0) {
		btn.addEventListener("click", function() {
			rows.forEach(function(item) {
				if (isVisible) {
					item.height = 0;
					item.visible = false;
				} else {
					item.height = 50;
					item.visible = true;
				}
			})
			isVisible = !isVisible
		})
	} else {
		rows.push(row);
	}
}

var table = Ti.UI.createTableView({
	data: [tblSection]
});

win.add(table);
win.open();

Steps to reproduce

  • start the app
  • click on hide/show twice
  • scroll down

Note:
it works sometime if you already scroll down first. But the initial launch without scrolling and just clicking the button has the error most of the time.

Platform

Android

SDK version you are using

13.0.0

Alloy version you are using

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidbugneeds triageThis issue hasn't been reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions