marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.39k stars 158 forks source link

mo.ui.table, allow disable selection for some rows. #1718

Open Eloitor opened 4 days ago

Eloitor commented 4 days ago

Description

I have a table that contains some parameters to be used for the rest of the notebook. Selecting one row, sets up the parameters.

Under some conditions, some combinations of parameters are not valid for the calculations I want to do.

Suggested solution

Allow disabling the selection of some rows, while displaying them.

Maybe in gray to show they are not available?

Alternative

No response

Additional context

No response

mscolnick commented 4 days ago

@Eloitor you could again use mo.state and track the selection and put up a warning (mo.callout) when there is an invalid selection

Eloitor commented 4 days ago

The disabled rows would make it more obvious.

Maybe passing a lambda to mo.ui.table that returns true if the row should be enabled, and false if it should be disabled.