我有闪亮的selectInput以及选项和一个按钮。因此,当我单击按钮时,必须删除闪亮的输入。但是它正在删除,不知道为什么!我使用了如下所示的闪亮的removeUI:
library(shiny)
# Define UI
ui <- fluidPage(
actionButton("rmv", "Remove UI"),
selectInput(
inputId=paste("FilterOperator",1,sep = "_"),
label = "",
choices=sort(unique(c("Begins with","Equals to","Not Equals to","Contains","Not Contains"))),
multiple=F,
selectize = F
)
)
# Server logic
server <- function(input, output, session) {
observeEvent(input$rmv, {
removeUI(
selector = paste("#FilterOperator",1,sep="_"),
multiple = TRUE,
immediate = TRUE,
session
)
print(input$FilterOperator_1) #It prints always a value instead of null
})
}
# Complete app with UI and server components
shinyApp(ui, server)
removeUI在selectInput上不起作用吗?请帮助我任何人。
已添加
:当我尝试使用上面的代码删除后获取值时,它仍然返回值而不是null。