Skip to content
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

incorrect columnGroups alignment under Shiny when column is hidden #253

Closed
Patrikios opened this issue Jul 8, 2022 · 1 comment
Closed
Labels
bug Something isn't working
Milestone

Comments

@Patrikios
Copy link

Patrikios commented Jul 8, 2022

In shiny app, if I hide a column, the grouping header is not correctly alligned, it becomes padded to a side. This is an issue when running under shiny, in vanilla reactable output from RStudio console it is not present.
In the reprex when you set vs = colDef(show = TRUE) the problem disapears.

Reprex:

library(shiny)
library(reactable)
shinyApp(
  ui = reactableOutput("react"),
  server = function(input, output) {
    output$react <- renderReactable(
      reactable(mtcars,
        columnGroups = list(
          colGroup(
            name = "Group A",
            columns = c("mpg", "cyl"),
            align = "center"
          ),
          colGroup(
            name = "Group B",
            columns = c("drat", "wt", "qsec"),
            align = "center"
          ),
          colGroup(
            name = "Group C",
            columns = c("carb"),
            align = "center"
          )
        ),
        columns = list(
          vs = colDef(show = FALSE)
        ),
        bordered = TRUE,
        theme = reactableTheme(
          borderColor = "black",
          borderWidth = 2L
        )
      )
    )
  }
)

Sample output on my mascihne:
image

R version 3.6.3 (2020-02-29)
shiny 1.7.1
reactable 0.3.0.9000

@glin glin added the bug Something isn't working label Jul 24, 2022
@glin
Copy link
Owner

glin commented Jul 24, 2022

Thanks for the bug report! The column group header width calculation wasn't accounting for hidden columns at all. It should now be fixed in the latest development version, 0.3.0.9000 (ce2d3c0):

  • Column group header widths are now calculated correctly with hidden columns
    in the column group (@Patrikios, #253).

@glin glin closed this as completed Jul 24, 2022
@glin glin added this to the v0.4.0 milestone Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants