You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1/ Is there any way to get the index of the row in on_select and on_activate? I now compute it using self._toga_table.data.index(row) (on_activate) or self._toga_table.data.index(self._toga_table.selection) (on_select) which seems more difficult than needed. I understand that Toga wants to make it easy to work with objects rather than indices but I cannot store all my data in the table so I need to translate to an index in my data.
2/ If I click twice (slowly, no double-click) on a cell in the table I can edit the cell value. Is this expected behavior? This does not have any effect in my case, since it doet not alter the original data in my application, but it is confusing for the user if the business logic does not allow editing the table data. If so, can it be disabled (e.g. read_only=True)?
3/ Is there any way to set the width of the columns? I seem to remember I was able to do this in an earlier version of Toga but this does not seem to be documented (anymore) or I am missing something.
4/ Is there any way to set the size of the table in number of visible rows?
There isn't currently a public API for exposing the selection index - but widget._impl.get_selection() will return the index (or a list of indices if the widget is a multi-select table). It might make sense to expose this as widget.selection_index; if you want to submit that as a PR, we'd consider it for inclusion.
Allow editing of table content definitely isn't intentional, so that's a bug. Could I ask you to open a ticket for that one - including details of the platform where you're seeing it.
There isn't currently an API for setting column width in a Table. The catch here is working out whether column size is a style concern, or a widget concern. Column renderers #1478 contains an initial draft of treating columns as standalone objects that might be able to adopt a style; but that PR hasn't been updated for a while. I'm not aware of any API that would have allowed this historically - SplitContainer allows for specifying how the content is distributed, but that's not really the same thing - and the needs here are different, as there's a need for both fixed size and flex size allocation.
There isn't an API to set size of a table based on a row count. That's going to be a complex thing to implement, because widget sizing is very separate from anything tied to table content. We might be able to expose "size guides" from the widget, and then allow the style to be set based on that size... but getting accurate sizing information could be complex.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I have some minor / quick questions about table:
1/ Is there any way to get the index of the row in on_select and on_activate? I now compute it using
self._toga_table.data.index(row)(on_activate) orself._toga_table.data.index(self._toga_table.selection)(on_select) which seems more difficult than needed. I understand that Toga wants to make it easy to work with objects rather than indices but I cannot store all my data in the table so I need to translate to an index in my data.2/ If I click twice (slowly, no double-click) on a cell in the table I can edit the cell value. Is this expected behavior? This does not have any effect in my case, since it doet not alter the original data in my application, but it is confusing for the user if the business logic does not allow editing the table data. If so, can it be disabled (e.g. read_only=True)?
3/ Is there any way to set the width of the columns? I seem to remember I was able to do this in an earlier version of Toga but this does not seem to be documented (anymore) or I am missing something.
4/ Is there any way to set the size of the table in number of visible rows?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions