Skip to content

Conversation

@m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 15, 2025

fixes #14316

var win = Ti.UI.createWindow();
var tblSection = Ti.UI.createTableViewSection();
var addNumber = 0;
var rows = [];
var isVisible = true;
for (var i = 0; i < 50; ++i) {
	var row = Ti.UI.createTableViewRow({
		height: 50,
	})
	if (i == 0) {
		row.layout = "vertical",
			row.height = Ti.UI.SIZE;
		var btn = Ti.UI.createButton({
			title: 'filter: hide0',
		});
		var btn2 = Ti.UI.createButton({
			title: 'search: hide0',
		});
		var btn3 = Ti.UI.createButton({
			title: 'filter: hide0, hide1',
		});
		row.add([btn, btn2, btn3]);

		btn.addEventListener("click", function() {
			table.searchText = "";
			if (isVisible) {
				table.filterText = "hide0";
			} else {
				table.filterText = "";
			}
			isVisible = !isVisible
		})
		btn2.addEventListener("click", function() {
			table.filterText = "";
			if (isVisible) {
				table.searchText = "hide0";
			} else {
				table.searchText = "";
			}
			isVisible = !isVisible
		})
		btn3.addEventListener("click", function() {
			table.searchText = "";
			if (isVisible) {
				table.filterText = ["hide0", "hide1"];
			} else {
				table.filterText = [];
			}
			isVisible = !isVisible
		})

	} else {
		addNumber++;
		if (addNumber > 2) {
			addNumber = 0;
		}
		var lbl = Ti.UI.createTextField({
			value: "hide" + addNumber,
		});
		row.title = "hide" + addNumber
		row.add(lbl)
	}
	tblSection.add(row);
	rows.push(row);
}

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

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

Will add searchText (like in ListView, took the code parts from those files) to the TableView so you can search for rows. It will also add filterText so you can filter out rows with the filterText value in the title.

Todo
Have a look at the iOS TableView to see if we can use the same there.

@m1ga m1ga changed the title feat(android): add searchText to TableView feat(android): add searchText/filterText to TableView Oct 15, 2025
@m1ga
Copy link
Contributor Author

m1ga commented Oct 20, 2025

@hbugdoll maybe you have an idea here:

8a9789d#diff-091b65382eb52bdd5bea8e4e965d65b6e044cac879d9e10104ac7a68e18868a8R1605-R1616

I want to use table.searchText = "text" on iOS too. I've copied that part from the listview (like I did on Android) and it's building the index correctly (I've added a log here) and it only adds correct values but it is not updating the TableView data.

You can can the example from the first comment and click on the "search: hide0" button. It should only show "hide0" fields after that. But it is still showing all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants