Can you help me understand and if possible correct my code, because when I press filters 1, 2 and 3, showModal does not appear and I believe it should.
library(shiny)
function.cl<-function(filter1,filter2,filter3){
df <- structure(
list(date = c("2021-01-01","2021-01-02","2021-01-03","2021-01-04","2021-01-05"),
d1 = c(0,1,4,5,6), d2 = c(2,4,5,6,7)),class = "data.frame", row.names = c(NA, -5L))
}
ui <- fluidPage(
ui <- shiny::navbarPage(theme = shinytheme("flatly"), collapsible = TRUE,
br(),
tabPanel("",
sidebarLayout(
sidebarPanel(
ui <- fluidPage(
radioButtons("filter1", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),selected=""),
radioButtons("filter2", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),selected=""),
radioButtons("filter3", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),selected=""),
radioButtons("filter4", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),selected=""),
radioButtons("filter5", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),selected=""))
),
mainPanel(
))
)))
server <- function(input, output,session) {
v <- reactiveValues(df = NULL, clear=FALSE)
ModelCl<-reactive({if (!is.null(v$df)) {
req(input$filter1,input$filter2,input$filter3)
showModal(modalDialog("Wait a moment...", footer=NULL))
on.exit(removeModal())
function.cl(input$filter1,input$filter2,input$filter3,input$filter4,input$filter5)
}
})
}
shinyApp(ui = ui, server = server)