library("shiny")
library("shinyWidgets")
# Countries
countries <- c(
"United Kingdom", "Germany", "United States of America", "Belgium", "China", "Spain", "Netherlands", "Mexico",
"Italy", "Canada", "Brazil", "Denmark", "Norway", "Switzerland", "Luxembourg", "Israel", "Russian Federation",
"Turkey", "Saudi Arabia", "United Arab Emirates"
)
ui <- fluidPage(
tags$h2("Select countries to drill down"),
dropdown(
circle = TRUE, status = "default", icon = icon("sliders"), width = "300px",
pickerInput(inputId = "Adverts",
label = "Countries",
choices = countries, # a list of strings
options = list(`actions-box` = TRUE, `live-search` = TRUE),
multiple = TRUE)
),
verbatimTextOutput(outputId = "res")
)
server <- function(input, output, session) {
output$res <- renderPrint({
input$Adverts
})
}
shinyApp(ui = ui, server = server)
Assuming I have application like this (adjusted example from issue #7):
I would like to combine live search and multiple selection. For example, I am interested in some countries that contain letter G (but only Germany and Belgium). Therefore, I search for G in the search box and I want to pick two countries (Germany and Belgium). Once I click on Germany the search menu expands and renders all available choices , hence disregarding the search input G. Is there a way to fix it? The same logic applies to unselecting choices, I am able to
select allcountries with G but when I try to unselect UK the list expands again.