mr_munshine
mr_munshineโ€ข11mo ago

Howdy ๐Ÿ‘‹

Howdy ๐Ÿ‘‹ I'm struggling with something seemingly simple. In this example (https://static.marimo.app/static/multitable-v9dk), what mechanism can I use to allow the end user to click on a row (or a button on a row), and have more info about that row show in a different cell (think a details view, that would show extra data not available on the table). I tried adding a button to each row, with a lambda and a state, but it doesn't seem to work. I can't directly use the table value, because the tab group doesn't tell you which tab is active. I feel like there must be a way. Any pointers? Thanks!
4 Replies
mr_munshine
mr_munshineOPโ€ข11mo ago
๐Ÿงต
Myles Scolnick
Myles Scolnickโ€ข11mo ago
@Akshay do you have a recipe for this? I saw some in the docs ( https://docs.marimo.io/recipes.html#grouping-ui-elements-together ) but nothing for tables Not helpful at the moment, but we may switch mo.tabs to be stateful with a value that you can access or control from the outside @mr_munshine , you could use mo.state and listen to the on_change. It wouldnโ€™t show the item from the current table but rather the last selected item
Akshay
Akshayโ€ข11mo ago
If you want to add buttons, and you know how many to create statically (before runtime), you could do this: https://static.marimo.app/static/button-in-table-dgja. In the future we might make it possible to create a dynamic number of buttons (or UI elements) in a table, similar to mo.ui.dictionary. Using the table values seems more natural though, as Myles as (I think) suggested
mr_munshine
mr_munshineOPโ€ข11mo ago
Thanks @Akshay, @Myles Scolnick . I'll try those out!