Populate a tableview from textfile containing a list of names

Do you now a better solution than mine ?

Remove the 2 slashes from the filename and remove the 2 list blocks, these are redundant

Taifun

Thank you, I tried in the past without the 2 list blocs without success, now it runs well, maybe there were some errors

Use the Tableviewer extension.

Hi TIMAI2, Tableviewer extension is not very easy to use,especially the selector, how can I learn selector usage?

How can I remove a selected item from the tableview populated as above ?

Meanwhile you deleted your blocks?
These looked fine
.

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Here is an example, I provided two alternatives for the list to be supplied to the tableviewer, you can use either method. These should both show the 'row/col' structure of your list. Selecting a cell in the table will remove the item from the list then redraw the table.

If this is not what you were after, then show your data, did you for example want to delete an entire row in the table ?

image

Thank you TIM for the useful examples, but I asked for selector usage

What do you want to do, use CSS or JavaScript to make visual changes?

Most actions are already covered in the Tableviewer topic.

CSS, I know most actions are already covered in the topic, but I would understand, not copy and paste

Again...

You should understand how to manipulate lists in AI2.

Read the introduction article in the FAQ.

Don't put the burden of list manipulation on any display mechanism.

When I select a cell I set the backgroundcolor to red, when I select another cell I would reset the previous cell backgroundcolor or better the table backgroundcolor

OK, thank you. Here are the required blocks, using javascript:

Script as text:

var cells = document.querySelectorAll("td");
cells.forEach(cell => {cell.style.backgroundColor='white';});

document.querySelector("#r`row`c`col`").style.backgroundColor='red';

Explanation:

  1. In an html table, each table cell has an html tag of "td"
  2. In Tableviewer, each cell is given an "id" based upon its row and column values, so that an individual cell or range of cells can be selected based upon their "id". For example id="r2c3" refers to the cell in the second row and the third column.
  3. The javascript above allows for three things:
  • When a cell not in row 1 (header row) is touched, all the table cells are selected by their td tag, and each cell background is set to white, clearing any previously selected red cell.
  • Also, the touched cell is selected by its id (rXcY format) using the # selector and its background is set to red.
  • If a header cell is touched, then all cells are set to white.

Thank you, it runs very well. It's not very difficult to understand.

is it possible to easily achieve the same goal using css?
Why not as attached ?

Yes, you can use css, but you would need to redraw the table each time

If you do not use clear table then the previously selected cell will also show.

Or you could do this:

Thank you very much