-
Notifications
You must be signed in to change notification settings - Fork 100
Recent update to Shiny 0.9.0 broke DataTable input #1345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Shiny 0.9.0 introduced many new DataTable features, which includes new syntax for retrieving the selected rows. The new syntax is much more flexible in the sense that it both allows finer grained control over what types of selections are allowed and makes it possible to retrieve the selected rows, columns or cells on the server side. The best example currently lives in the API reference: https://shiny.posit.co/py/api/core/render.DataGrid.html. We definitely need to update the examples in the components gallery to match the new syntax. Here's an updated version of the demo example you linked to: from palmerpenguins import load_penguins
from shiny import render
from shiny.express import input, ui
penguins = load_penguins()
ui.h2("Palmer Penguins")
@render.ui
def rows():
rows = penguins_df.data_view(selected=True) # <2>
selected = ", ".join(str(i) for i in sorted(rows.index)) if not rows.empty else "None" # <3>
return f"Rows selected: {selected}"
@render.data_frame
def penguins_df():
return render.DataTable(penguins, selection_mode="rows") # <1> Notice that:
|
I'd like to throw my bit here.
Cheers! |
Yes. It was removed without warning. Sorry 'bout that! I'll restore it for the next release and add a clear news item about removing it in a future release.
Good news... With a combination of py-shiny/shiny/render/_data_frame.py Lines 405 to 412 in 3b742a2
py-shiny/shiny/render/_data_frame.py Lines 492 to 502 in 3b742a2
.data_view_indices(*, selected: bool = False) ? (Similar to .data_view(*, selected: bool = False) )
It could return a py-shiny/shiny/render/_data_frame_utils/_selection.py Lines 162 to 185 in 3b742a2
For the return value, I still don't know if class DataViewIndices(TypedDict):
type: Literal["row", "col", "rect", "none"]
rows: ListOrTuple[int]
cols: ListOrTuple[int]
# class data_frame...
def data_view_indices(self, *, selected: bool = False) -> DataViewIndices:
... @pstorozenko Glad you like
Can I get a copy of your crystal ball? 😆 I'd love to move to something like https://github.com/data-apis/dataframe-api-compat , however to get typing support, their typing specification is defined deep within another repo: https://github.com/data-apis/dataframe-api/tree/main/spec/API_specification/dataframe_api . I do not understand why the types being used within |
Original issue is being fixed in #1377 . Making new issue for |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
The recent update to Shiny 0.9.0 broke the DataTable input, which was one of the updates in this new version.
At this point
input.<tableID>_selected_rows()
stopped working and is no longer updating any reactive function.You can check your own demo example provided in the documentation to see it is broken.
I hope this can be patched soon :) Downgrading to version 0.8.1 reverts the issue.
Thanks!
The text was updated successfully, but these errors were encountered: