(AD) 使用 shinywidgets 从 pickerInput 移除 "Select All" 操作按钮
(AD) Remove "Select All" action button from pickerInput using shinywidgets
继续这里提到的讨论:
Remove "Select All" action button from pickerInput using shinywidgets
OP 有此代码并尝试删除 select/deselect 按钮之一:
pickerInput(inputId = "country_select_list", label = "Select countries", choices = country_list, multiple = TRUE, options = pickerOptions(actionsBox = TRUE))
答案是利用 CSS:
.bs-select-all {
display: none;
}
这部分代码究竟应该放在哪里才能使 select-all 按钮消失?
试试这个
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)
继续这里提到的讨论:
Remove "Select All" action button from pickerInput using shinywidgets
OP 有此代码并尝试删除 select/deselect 按钮之一:
pickerInput(inputId = "country_select_list", label = "Select countries", choices = country_list, multiple = TRUE, options = pickerOptions(actionsBox = TRUE))
答案是利用 CSS:
.bs-select-all {
display: none;
}
这部分代码究竟应该放在哪里才能使 select-all 按钮消失?
试试这个
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)