我想根据selectInput的输入来控制modalDialog的外观,最好的方法是什么?我已经尝试了以下代码,但是conditionpanel在modalDialog中不起作用。 (显示部分代码)
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())
})
}
答案 0 :(得分:1)