Skip to content

Conversation

wch
Copy link
Contributor

@wch wch commented Apr 30, 2024

This fixes documentation and examples on doing row selections, for Shiny 0.9.0.

@wch wch requested a review from gadenbuie April 30, 2024 20:57
@github-actions github-actions bot temporarily deployed to pr-143 April 30, 2024 21:13 Destroyed
@github-actions github-actions bot temporarily deployed to pr-143 May 1, 2024 16:56 Destroyed
@@ -9,11 +9,11 @@

@render.ui()
def rows():
rows = input.penguins_df_selected_rows() # <<
rows = penguins_df.input_cell_selection()["rows"] # <<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good change in the sense of having the existing example run correctly with shiny 0.9.0.

We don't necessarily need to do it in this PR, but this example is less motivating now that the output object has more methods. It'd be nice if this example or a variant in this section gave more instruction about those methods and how to use them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that there should be an example that shows other methods. I think it makes sense to merge now and then when @schloerke, discuss with him about other examples.


The value returned will be `None` if no rows are selected, or a tuple of integers representing the indices of the selected rows. To filter a pandas data frame down to the selected rows, use `df.iloc[list(input.<id>_selected_rows())]`.
The value returned will be an empty tuple if no rows are selected, or a tuple of integers representing the indices of the selected rows. To filter a pandas data frame down to the selected rows, use `df.iloc[list(<name>.input_cell_selection()["rows"])]`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very least, I think this section should give the user a hint that .input_cell_selection() isn't the only method (maybe in a paragraph below this one) with a pointer to our docs where they might learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea -- I've added a bit of info and link to the API docs.

@gadenbuie
Copy link
Contributor

@wch I just went looking for this example and realized that the docs aren't live yet, so I'm going to merge this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants