Table in a container does not display or update as expected.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 40
Description
### Describe the bug
possibly an extension to: https://github.com/beeware/toga/issues/2974
A table within a container does not initially expand columns
The table does not display data updates when the underlying data is updated.
A row edit is not reflected in a change in the display
Append and Delete Rows show updated data including pending row edits.
### Steps to reproduce
I attach a test program that can be run in a dev environment to demonstrate the problem.
A new table in an opcontainer is displayed with compressed columns.
To Test: Press the Run table Test button. There are 5 tests.
1 use append to add a new Row. New Row **IS** visible
2 use find to find row matching the given attribute and value - an exact match.
3 set row attribute using tablet.data[rowid].__setattr__('age',999), updated value **is NOT** shown
4 set row attribute, _upsert_ function will update an existing row OR insert a new row.
new value of age = 0 expected but **NO** change shown
5 delete an existing row, the table display updates to not show the removed row as expected but does now show the
previously updated updated age for the last row.
[
[tabletest.zip](https://github.com/user-attachments/files/18148994/tabletest.zip)
]
### Expected behavior
On a programmatic change in data e.g. made with a call to tablet.data[rowid].__setattr__('age',999) I would expect the underlying ListSource to update and the display to reflect the change. However although it can be shown the ListSource has changed the display does not update.
Note that the change does show following a subsequent Row Delete action
### Screenshots

following a further update to age = 0 and a Row Delete:

### Environment
- Operating System: Windows 10 64bit
- Python version: 3.10.5
- Software versions:
- Briefcase-Version: 0.3.20
- Toga: 0.4.8
- ...
### Logs
terminal putput:
```
> Upsert Zaphod age 0
> Looking for Zaphod
> 0
> 1
> 2
> 3
> Found Zaphod at 3
> Updating Zaphod age 0 at row 3
> Updated Zaphod age 0
> Looking for Zaphod
> 0
> 1
> 2
> 3
> Found Zaphod at 3
> Deleting Row Arthur
> Looking for Arthur
> 0
> Found Arthur at 0
```
[briefcase.2024_12_16-11_05_11.dev.log](https://github.com/user-attachments/files/18148977/briefcase.2024_12_16-11_05_11.dev.log)
Contributor guide
Research direction
Start by running the attached tabletest.zip program in the stated development environment and use its five table tests, especially the programmatic age updates and row deletion. Read the table-in-container and ListSource behavior implicated by the reproduction; done means columns expand initially and appended, edited, upserted, and deleted rows are immediately reflected in the display.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100