1

继续这里提到的讨论:

使用 shinywidgets 从 pickerInput 中删除“全选”操作按钮

OP 有此代码并尝试删除选择/取消选择按钮之一:

pickerInput(inputId = "country_select_list", label = "Select countries", choices = country_list, multiple = TRUE, options = pickerOptions(actionsBox = TRUE))

答案是利用 CSS:

.bs-select-all {
  display: none;
}

这部分代码究竟应该放在哪里,以便全选按钮消失?

4

1 回答 1

2

尝试这个

library(gapminder)

my_css <- "
.bs-select-all {
  display: none;
}
.bs-deselect-all {
  width: 100%;
}
"

df <- gapminder
country_list <- unique(df$country)

ui <- fluidPage(
  tags$head(tags$style(HTML(my_css))),
  pickerInput(
    inputId = "country_list", 
    label = "Select countries", 
    choices = as.character(country_list), 
    multiple = TRUE, 
    options = pickerOptions(actionsBox = TRUE)
   
  )
)

server <- function(input, output) {}

shinyApp(ui, server)
于 2021-04-13T13:24:43.807 回答