How programmatically select a table row? #2641
Replies: 2 comments 9 replies
-
There are examples of dialogs here: I have no idea about the tables, I'm still experimenting with this framework myself but I will surely later make my own table widget with fields editable on the spot. As I see it, a table is just a box containing other boxes. So rows are boxes and in each row you could possibly put input boxes. Not sure how well this would work thought. Perhaps there are big performances hits on having that many input widget on one screen. |
Beta Was this translation helpful? Give feedback.
-
What you're thinking of as a "dialog box" is effectively a secondary window that has known content. What you've got implemented as the on-page row modification widgets could be constructed as the content of a secondary window that is displayed and populated in response to selecting a row in the table. As for committing values - the key here is to understand the ListSource structure that is used by Toga to represent Table data. When you instantiate a table, Toga takes that data and turns it into a ListSource - a collection of Row objects that can be managed like a list. This is distinct from the original "list of dicts" or whatever you've used to populate the table in the first place. The Row object is what is returned when you ask for |
Beta Was this translation helpful? Give feedback.
-
Hi there
I'm new to beeware and toga, simply started this by the guide of ChatGPT and asking anything from that bot.
I have a table that loads data form multiple CSV files in a view and I want to be able to edit some of those fields and save the changes to the appropriate CSV file. the code is working finally. but the problem is after saving the changes I have to refresh the view to sort the rows again, here I loose the focus on the selected row of the table and there is not such a table.select or similar method to let me select a row programmatically (say using my code).
also there was another issue for me, I was looking for an dialog box to ask user to enter their intended values using that such a dialog box but I couldn't find such a thing in toga so I ended up using a different approach and I added some label and inputs and not visual variables to let user enter their data.
thanks for your attention.
Beta Was this translation helpful? Give feedback.
All reactions