我目前遇到了烦人的问题,我创建了一个observeEvent({})来基于按钮的交替点击添加/删除一些UI元素,但是在添加元素之后,后续点击按钮无法删除它。
server <- function(input, output,session) {
global <- reactiveValues(add.A = FALSE)
observeEvent(input$add.A,{
global$add.A = !global$add.A
if(global$add.A){
insertUI(
selector = "#heading",
where = "afterEnd",
ui = div(id = "alleles.A",
fluidRow(
column(width=6,
div(div(class="ddown",uiOutput("Recipient.HLA.A.1")),div(class="ddown",uiOutput("Recipient.HLA.A.2")))
),
column(width=6,
div(div(class="ddown",uiOutput("Donor.HLA.A.1")),div(class="ddown",uiOutput("Donor.HLA.A.2")))
)
)
)
)
}else{
removeUI(selector = "#alleles.A")
}
})
}