简体   繁体   中英

How do I display a text output when I click deselect all?

For my shiny app, I am using a pickerInput. When "deselect all" is selected, the output of my datatable shows an error. I am looking to print a string that says " Make sure to select an option!" when deselect all is selected. Do I have to use observeEvent, or can I use an if statement in my server code?

Here is an example of the pickerInput code: pickerInput("type", "Select Option", choices = c("a","b","c", "d"), selected = c("a","b","c","d"), options = list('actions-box' = TRUE), multiple = T)

Here is an example of the server code: output$one<- DT::renderDT({DT::datatable(caption = "table", options = list(pageLength = 50),tab1<- rbind(red, blue,green, yellow)%>% filter(num> .450, letter == input$type))

如果出错,您可以隐藏数据表或返回 NULL 并通过 shinyalert 显示消息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM