使用 updateReactable 更新复选框的选择选项在 Modal 中不起作用。但是,当我离开模态并再次输入时,它可以工作。
以下是可重现的代码:
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)