Buttons in tables
Is there a way I can add a column to a marimo table that is an icon that is connected to a callback? So for example like a delete button for a row on a table?
8 Replies
You can create the buttons beforehand using mo.ui.array. And then re-index into the array when creating the table columns (if row oriented). And column oriented should work as is.
There might be an example in the docs (im on my phone rn).
For the callback- there is a common gotcha of lazy bindings to lambdas - so I’d avoid a lambdas in there
Any idea if I can insert buttons into a polars dataframe?
I guess I can just go try it and see what happens
I don’t think I’ve tried - would be a good snippet though if possible
I’ll let you know what I find
Only slightly related to this, is there any way to set the label of a button to an image? Using mo.icon doesn't work
Not currently - I’ve wanted to add click (and hover) events to all ui elements. But haven’t done so
No problem. Just checking!
This does not work in polars. But it does work pretty well when you go from a data frame to column oriented dictionary and then add your buttons that way
Also, partial functions worked great here.
If it’s not too much trouble, would love the snippet to add to marimo’s snippets
Oh definitely. I specifically had a delete button deleting things from a DB. I’ll change it to see if I can delete from the table instead!