Open mdaeron opened 1 month ago
Related - Add ability to update cells and data from the server: https://github.com/posit-dev/py-shiny/issues/1449
Pasting into an editable datagrid does not appear to be currently implemented ...
Correct. As of v1.0.0, this is not implemented. (But it could be in the future! Will expand on this in followup comment)
... and the fact that DataGrid is explicitly defined as an output makes me wonder if my use case is at odds with some core philosophy of shiny, such as "input data resides on the server", or "input data must be uploaded from a file".
We already have the ability to edit a data frame within the browser via a single cell edit.
The current approach has been:
@render.data_frame
. We can access the updated data via .data_view()
and the original data via .data()
is at odds with some core philosophy of shiny
It is definitely different as updates are happening to the rendered output after the initial rendering has occurred.
But if the decorated @render.data_frame
method is executed again (due to reactivity), then (currently) the user edits, user sorting, and user filtering is dropped. Everything is reset. This prevents us from entering a permanent dirty state where a previous interaction has compromised the current state that we can not escape.
such as "input data resides on the server", or "input data must be uploaded from a file"
@render.data_frame
needs the data to be returned from it's decorated function. It does not care how it gets there... from a file or from the server itself.
Questions I run into with pasting data:
error: str
?.set_patches_fn
handle everything?None
values on the server? (What value is used as a placeholder value? Will it conflict with the column type (polars)?)On the server side, we can get pretty far with .update_cell_value()
and .update_data()
proposed in #1449 .
Goal: Reduce this question set . Any thoughts or approaches appreciated!
This is half a feature request, half a question about how shiny conceptualizes data input.
I'd like to use shiny to help my researcher colleagues process some analytical data. Because most of the potential users are not proficient coders, the most accessible/realistic way to input data should be copy-and-paste from a spreadsheet app into the shiny app. Pasting into an editable datagrid does not appear to be currently implemented, and the fact that DataGrid is explicitly defined as an output makes me wonder if my use case is at odds with some core philosophy of shiny, such as "input data resides on the server", or "input data must be uploaded from a file".
My two cents: pasting into a datagrid offers at least two benefits over simply pasting data into a text area: (a) because any problems in formatting/cell mismatches are immediately apparent, the user can easily perform some kind of visual data validation; (b) one thing end-users frequently mistype is column headers; this problem disappears if the headers are already specified by a datagrid input.
So, is it possible that datagrids will some day be treated as full-blown inputs, or would that break things and/or go against some core conceptualization of py-shiny?