-
Notifications
You must be signed in to change notification settings - Fork 81
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
Table not rendering when with CSV download button #377
Comments
Hi, did you figure this out yet? If you're using RStudio here, it might be the bug with R 4.4.0 breaking the viewer in RStudio on Windows. Upgrading to R 4.4.1 fixed this for me. See rstudio/rstudio#14603 |
Thank you for the feedback, @glin . Unfortunately not, I upgraded to R 4.4.1, updated all packages, tested in RStudio Viewer and in all external browsers, but the issue remains... Unlike rstudio/rstudio#14603 , the title What is your version of Are you using EDIT: Now I replicated the issue with |
Sorry I didn't pay close attention and look at the app, just saw the session info and thought of the RStudio issue immediately. The problem is actually that library(shiny)
library(reactable)
n=1e4
df <- data.frame(
id = 1:n,
x = runif(n),
name = sample(c("João", "Maria", "Cláudia", "Alice", "Mike",
"Emma", "Tom", "Sarah", "David", "Lily"), n, replace = TRUE),
z = sample(1:100, n, replace = TRUE)
)
ui <- fluidPage(
titlePanel("reactable example"),
tagList(
tags$button(
tagList(fontawesome::fa("download"), "Download as CSV"),
onclick="Reactable.downloadDataCSV('table', 'df.csv')"
),
reactableOutput("table")
)
)
server <- function(input, output, session) {
output$table <- renderReactable({
reactable(df,
pagination = TRUE,
height = 350,
defaultPageSize = 100,
showPageSizeOptions=TRUE,
pageSizeOptions = c(10, 50, 100, 1000),
highlight = TRUE,
sortable = TRUE,
resizable = TRUE,
filterable = TRUE,
searchable = TRUE
)
})
}
shinyApp(ui, server) Also, for Shiny outputs, the table ID for the JavaScript API is the Shiny output ID, so that would be We could probably use more examples for more complex Shiny apps like this. And also, it would be better if |
I understand @glin , the problem with this method is that you separate the download button from the table, so they are not rendered simultaneously. For example, I have an app that I want to display the whole table only after I click in the button Of course you can add another reactive piece to hide the download button, however it adds unnecessary complexity to an app with many tables. Is there another way to render the download button together with the table (as Thank you |
You'll probably want library(shiny)
library(reactable)
n=1e4
df <- data.frame(
id = 1:n,
x = runif(n),
name = sample(c("João", "Maria", "Cláudia", "Alice", "Mike",
"Emma", "Tom", "Sarah", "David", "Lily"), n, replace = TRUE),
z = sample(1:100, n, replace = TRUE)
)
ui <- fluidPage(
titlePanel("reactable example"),
uiOutput("table_ui")
)
server <- function(input, output, session) {
output$table_ui <- renderUI({
tagList(
tags$button(
tagList(fontawesome::fa("download"), "Download as CSV"),
onclick="Reactable.downloadDataCSV('table', 'df.csv')"
),
reactableOutput("table")
)
})
output$table <- renderReactable({
reactable(df,
pagination = TRUE,
height = 350,
defaultPageSize = 100,
showPageSizeOptions=TRUE,
pageSizeOptions = c(10, 50, 100, 1000),
highlight = TRUE,
sortable = TRUE,
resizable = TRUE,
filterable = TRUE,
searchable = TRUE
)
})
}
shinyApp(ui, server) |
Thank you, @glin . |
Hi folks, the table is not rendering when I add the CSV download button.
I'm trying this code:
And getting this empty page:
Am I doing something wrong?
Thank you
The text was updated successfully, but these errors were encountered: