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
In the mo.ui.Table component (https://docs.marimo.io/api/inputs/table/) it's possible to select one or more rows when clicking on the table. I propose adding more selection modes to make it possible to select a cell and get both the row and column information associated with that cell.
In our use case we have some fairly wide dataframes and would like our users to be able to trigger some charts on more than one dimension by just clicking one cell.
Suggested solution
In the mo.ui.Table component we have the argument:
cell: when a cell is clicked then both the row and column information is sent to the defined on_change callback.
At the moment, the on_change callback is called with a list of dicts of all the information in the selected rows. I'm not sure what is a clean way to do this, but two suggestions come to mind:
Keep this first argument the same but add an additional argument which contains the row_idx and the column name which was selected.
Add the row_idx and column name into the existing argument e.g.:
Makes sense, I think we can support this. I would see the options as:
single -> implies single-row (for back-compat)
multi -> implies multi-row (for back-compat)
single-cell
multi-cell
# maybe layer
single-column
multi-column
In call cases, the response will likely be the same shape passed in. So if a dataframe is pass in, the on_change and .value will be a dataframe. if its a list/dict, itll be a list/dict.
I agree in terms of the data returned. Our main use case is actually dataframes, so the user would necessarily get the row index in the dataframe case. However in the list/dict case how would you propose giving the user enough metadata to make it useful?
If I had set this up as a list/dict instead of a dataframe and the user clicked the 4.0 value, would you propose passing in something like the following?
Description
In the
mo.ui.Table
component (https://docs.marimo.io/api/inputs/table/) it's possible to select one or more rows when clicking on the table. I propose adding more selection modes to make it possible to select a cell and get both the row and column information associated with that cell.In our use case we have some fairly wide dataframes and would like our users to be able to trigger some charts on more than one dimension by just clicking one cell.
Suggested solution
In the
mo.ui.Table
component we have the argument:At the moment this allows two modes:
single
: only one row can be selectedmulti
: many rows can be selectedI propose adding a new option to this:
cell
: when a cell is clicked then both the row and column information is sent to the definedon_change
callback.At the moment, the
on_change
callback is called with a list of dicts of all the information in the selected rows. I'm not sure what is a clean way to do this, but two suggestions come to mind:Would become:
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: