R 如何在模态对话框中添加条件面板

R 如何在模态对话框中添加条件面板,r,shiny,R,Shiny,我想根据selectInput的输入控制modalDialog的外观,最好的方法是什么?我尝试了以下代码,但conditionalpanel在modalDialog中不起作用。(显示部分代码) ui您可以尝试使用bsModal将模式对话框移动到ui.R。有关示例,请参见此处: 希望这有帮助!弗洛里安问题解决了!条件参数中缺少“”。 ui<-fluidPage( selectInput("v1",c("Active_ingredient","Brand_Name"), ac

我想根据selectInput的输入控制modalDialog的外观,最好的方法是什么?我尝试了以下代码,但conditionalpanel在modalDialog中不起作用。(显示部分代码)


ui您可以尝试使用bsModal将模式对话框移动到ui.R。有关示例,请参见此处:


希望这有帮助!弗洛里安

问题解决了!条件参数中缺少“”。
ui<-fluidPage(
    selectInput("v1",c("Active_ingredient","Brand_Name"),
    actionButton("tabBut", "Select Drug and Event...", style='primary')
    )

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

dataModal<-function(failed=FALSE){
modalDialog(
         conditionalPanel(
           condition="input.v1==Active_ingredient",
           selectizeInput_p("t1", "Active Ingredient",
                            choices=c("start typing to search..."="",ing_choices),
                            HTML( tt('drugname1') ), tt('drugname2'),
                            placement='bottom')
         ),
         conditionalPanel(
           condition="input.v1==Brand_Name",
           selectizeInput_p("t1_1", "Name of Drug",
                            choices=c("start typing to search..."="",drug_choices),
                            HTML( tt('drugname1') ), tt('drugname2'),
                            placement='bottom')
         ),
         selectizeInput_p("t2", "Adverse Events",choices= c("Start typing to search"=""), 
                          HTML( tt('eventname1') ), tt('eventname2'),
                          placement='left'),               
         numericInput_p('maxcp', "Maximum Number of Change Points", 3, 1, step=1,
                        HTML( tt('cplimit1') ), tt('cplimit2'),
                        placement='left'),

         footer = tagList(
           modalButton("Cancel"),
           actionButton("update", "OK")
         )
   )
}

         observeEvent(input$tabBut, {
         showModal(dataModal())
     })
}