Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): tableView row parent #13826

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented May 8, 2023

Split out of the "optimize tableview updates" PR to test it separately.

Will keep the click event when reassigning the data:

var menu = [];
var lab = Ti.UI.createLabel({text: "Row 0"});
var numrows = 0;

var self = Ti.UI.createWindow({title: "Table Test"});
var table = Ti.UI.createTableView({});

table.addEventListener("click", function(e) {
  console.log("Row " + e.index);
  lab.text = "Clicked " + e.index;
  menu[1].title = "Clicked " + e.index;
  if (e.index == numrows - 1)
    AddRows();
});

function AddRows() {
  var row = Ti.UI.createTableViewRow({title: "Row " + numrows});
  if (menu.length == 0)
    row.add(lab);
  menu.push(row);
  numrows++;
  var row = Ti.UI.createTableViewRow({title: "Row " + numrows});
  menu.push(row);
  numrows++;
  table.data = menu;
};

AddRows();
self.add(table);
self.open();

click on the last row to add more rows and then click on any row above it. The first row should update with the correct clicked number and there is a console output.

@m1ga m1ga marked this pull request as draft May 13, 2023 23:58
@m1ga m1ga marked this pull request as ready for review September 16, 2023 13:05
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.

2 participants