-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat(data frame): Expose .data_view_rows()
, .input_sort()
, .input_filter()
, .update_sort()
, and .update_filter()
#1374
base: main
Are you sure you want to change the base?
Conversation
…contained in the index
* render_df_bugs: Update _renderer.py Restore `input.<ID>_selected_rows()`. Add tests Make sure the index being subsetted is less than the row length, not contained in the index Update CHANGELOG.md Only subset the selected data if the index row exists!
shiny/render/_data_frame.py
Outdated
@@ -275,6 +285,18 @@ def data_view(self, *, selected: bool = False) -> pd.DataFrame: | |||
else: | |||
return self._data_view_all() | |||
|
|||
data_view_info: reactive.Calc_[DataViewInfo] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add public-facing examples that use this.
For example: an app where there is an interactive table, and below it, a code output that prints out:
- The values of
sort
andfilter
- A data frame using
rows
, which reflects exactly the sorted and filtered data that the user is seeing in the interactive table, and also has an extra column indicating whether that row is selected. - Also add a second code output that just prints the value of
.data_view(selected=TRUE)
.
…r` for consistency
After Friday discussion: drop |
* main: bug(output transformer): fix transformer auto-registration (#1394) fix: Add wait till pulse animation has started (#1393) bug(test-deploy): Add retries for deploy tests (#1392) Add busy indicator tests (#1391) Yield to give "synchronous" writes a chance to complete (#1388) chore(busy indicator): Update busy indicator css files (#1389) feat(cli): Add `shiny --version` (#1387) fix(selectize): Accept jsonifiable values in `options` dictionary (#1382) bug(data frame): Use `<ID>_data_view_rows` (#1386)
.data_view_info()
for @render.data_frame
object.data_view_rows()
, .input_column_sort()
, .input_column_filter()
, .update_column_sort()
, and .update_column_filter()
.data_view_rows()
, .input_column_sort()
, .input_column_filter()
, .update_column_sort()
, and .update_column_filter()
.data_view_rows()
, .input_sort()
, .input_filter()
, .update_sort()
, and .update_filter()
…pe; Change row order to data view row order (#1376)
Fixes #1351
Fixes #1345
Fixes #1378
Related to #1345 (comment)
Related discussion #1345 (comment) with @pstorozenko
Final solution:
Expose.data_view_info()
reactive value which returnsDataViewInfo
which is defined as a list of data view information.Expose individual reactive values for the user to access on their own:
.data_view_rows: Calc_[tuple[int]]
.input_sort: Calc_[ListOrTuple[ColumnSort]]
.input_filter: Calc_[ListOrTuple[ColumnFilter]]
.update_sort(self, sort: ListOrTuple[ColumnSort | int] | ColumnSort | int | None)
int
values are upgraded to{col: <INT>, desc: bool}
;desc
defaults to True if column<INT>
is number like, otherwiseFalse
..update_filter(self, sort: ListOrTuple[ColumnFilter] | None)
From #1376
Previous return type for
.input_cell_selection()
:New return type for
.input_cell_selection()
:If
type = "none"
,rows
andcols
are empty tuples.If
type = "row"
,cols
is all column numbers of the data.If
type = "col"
,rows
is all row numbers of the data view rowsIf
type = "rect"
, all rows and cols are provided (no longer just min/max values).If
.input_cell_selection()
receives an empty selection (e.g.type="row"
androws=[]
, ortype="none"
), then the return value will beNone
as no selection is currently taking place.Previous user interaction:
New user interaction: