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

Using pagination = FALSE seems to automatically set the pagesize to max row of df #214

Closed
daeyoonlee opened this issue Nov 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@daeyoonlee
Copy link

Thanks for the great package.

Using pagination = FALSE seems to automatically set the pagesize to max row of df.
Because of this, overflowing rows may appear to not be rendered. (Increasing max-row does nothing)

library(shiny)
library(reactable)

ui <- fluidPage(
  numericInput(inputId = "max_rows", label = "max_rows", value = 12),
  reactableOutput(outputId = "table"),
)

server <- function(input, output, session) {
  
  output$table <- renderReactable(
    reactable(
      data = iris[1:isolate(input$max_rows),],
      pagination = FALSE,
      showPagination = FALSE,
      selection = "single",
      selectionId = "table_rows_selected",
      onClick = "select"
    )
  )
  
  observe(
    updateReactable(
      outputId = "table",
      data = iris[1:input$max_rows,]
    )
  )
}

shinyApp(ui, server)

Currently to solve this, pagination = TRUE and defaultPageSize to a large enough number.

library(shiny)
library(reactable)

ui <- fluidPage(
  numericInput(inputId = "max_rows", label = "max_rows", value = 12),
  reactableOutput(outputId = "table"),
)

server <- function(input, output, session) {
  
  output$table <- renderReactable(
    reactable(
      data = iris[1:isolate(input$max_rows),],
      pagination = TRUE,
      defaultPageSize = 10000,
      showPagination = FALSE,
      selection = "single",
      selectionId = "table_rows_selected",
      onClick = "select"
    )
  )
  
  observe(
    updateReactable(
      outputId = "table",
      data = iris[1:input$max_rows,]
    )
  )
}

shinyApp(ui, server)
@glin glin added the bug Something isn't working label Jan 1, 2022
@glin
Copy link
Owner

glin commented Jan 1, 2022

Good catch, this was an easy way to "disable" pagination, but I guess it breaks down when you use updateReactable() to change the data 😅. This should now be fixed in the dev version (f406c62), so pagination = FALSE should work in all cases. Thanks!

@glin glin closed this as completed Jan 1, 2022
@daeyoonlee
Copy link
Author

Thank you!

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