Skip to content

Add support for groups in opt_interactive() via reactable groupBy #1725

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

Merged
merged 4 commits into from
Jun 21, 2024

Conversation

olivroy
Copy link
Collaborator

@olivroy olivroy commented Jun 19, 2024

Summary

  • Use defaultExpanded = TRUE + groupBy in reactable::reactable()
  • FIddle to add the group data to data_tbl in render_as_i_html()

Here is an implementation of showing groupname_col. This feels incomplete, but wanted to get the ball rolling,

Basically,

mtcars |> dplyr::slice_head(n = 10) |> gt(groupname_col = "vs") |> opt_interactive()

Now (hide group cols):
image

This PR:
image

Let me know if you can think of how this could be improved.

I think this opens the door to supporting summary_rows().

Is there a way to test (at least visually the interactive output. Maybe a new vignette that contains just examples could be created?

Just to visually be able to see what's going on, and if regressions are not introduced by my fiddling.

Limitations

  • Wrong number of rows shown
  • No merged column groups
  • Wrong row total number
  • Still no summary_rows
  • ignores a couple things probably, such as the css of groups. This could easily be added if necessary
  • cols_hide() respected?

Advantage

  • Actually show group cols
  • expanding cols

Related GitHub Issues and PRs

Checklist

@olivroy olivroy changed the title Add support for opt_interactive() + add comments on its limitations. Add support for groups in opt_interactive() via reactable groupBy + add comments on its limitations. Jun 19, 2024
@olivroy olivroy changed the title Add support for groups in opt_interactive() via reactable groupBy + add comments on its limitations. Add support for groups in opt_interactive() via reactable groupBy Jun 19, 2024
@rich-iannone
Copy link
Member

I totally agree with this implementation! As for testing, the article/vignette route might be the only practical way to go.

@olivroy
Copy link
Collaborator Author

olivroy commented Jun 20, 2024

Sweet. I can look into doing this afterwards!

@rich-iannone rich-iannone self-requested a review June 21, 2024 13:37
Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

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

LGTM

@rich-iannone
Copy link
Member

Everything looks good here. I understand you want to follow up with further changes in other PRs. In that case is this PR ready to merge?

@olivroy
Copy link
Collaborator Author

olivroy commented Jun 21, 2024

Yes. This PR is good to go!

@rich-iannone rich-iannone merged commit a6d3401 into rstudio:master Jun 21, 2024
12 checks passed
@olivroy olivroy deleted the interactive-groupname branch June 21, 2024 19:02
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.

groupname_col disappears with opt_interactive()
2 participants