dimanche 2 mai 2021

R Shiny Reactable - Selection option to update checkboxes using updateReactable doesnt work inside Modal

Selection option to update checkboxes using updateReactable doesnt work inside Modal. However, when I leave the modal and enter again it works.

Below is the reproducible code:

library(shiny)
library(reactable)

ui <- fluidPage(
actionButton("bt", "Load Modal")

)

server <- function(input, output, session) {

output$table <- renderReactable({
reactable(iris, selection = "multiple")
})

observeEvent(input$bt,{

showModal(
  modalDialog(tags$head(tags$style(".modal-dialog{ width:1500px}")),
              fluidRow(
                titlePanel("reactable example"),
                reactableOutput("table")
              ),
  title = h2("Editar informações"),
  size = 'l',
  footer = tagList(
    modalButton("Cancel")
  )
))

# Select rows
updateReactable("table", selected = c(1, 3, 5))
})
}
shinyApp(ui, server)



Aucun commentaire:

Enregistrer un commentaire