Given this small shiny app:
library(shiny)
library(tidyverse)
library(shinydashboard)
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(uiOutput("graphs_ui")),
)
server <- function(input, output, session) {
popup <- function(){ modalDialog(easyClose = T,'popup window triggered')}
output$graphs_ui <- renderUI({
map(1:2, ~{
tagList(box(title = paste0("Isolation: ", .x),
status = "info",
footer = checkboxInput(paste0("check_", .x),"")))})
})
observeEvent(map(grep(pattern = "check_", names(input), value = TRUE), ~input[[.]]),{
showModal(popup())}, ignoreInit = T)
}
shinyApp(ui, server)
I want to trigger a dialog "popup" upon checking one of the checkboxes. Problem is that the dialog already pops up after initalizing the app, althoug I set ignoreInit = TRUE
. I have no idea why, since the behavior remains when using actionButton
.
Aucun commentaire:
Enregistrer un commentaire