R Shiny pickerInput选择所有文本

时间:2018-05-31 03:47:42

标签: r shiny

使用shinywidgets pickerinput我正在尝试使用下拉列表。下面是代码。当用户选择所有输入时,有人可以告诉我如何在显示输入中显示文本总数。我可以显示计数而不是文本总数。

master

1 个答案:

答案 0 :(得分:2)

这样的东西?

修改:根据请求I just want the text "TOTAL" when everything is selected

library("shiny")
library("shinyWidgets")

mychoices <- c("Banana", "Blueberry", "Cherry", "Coconut", "Grapefruit","Kiwi", "Lemon", "Lime", "Mango", "Orange", "Papaya")
ui <- fluidPage(
  column(
    width = 4,
    pickerInput(
      inputId = "id", label = "Choices :",
      choices = mychoices,
      options = list(`actions-box` = TRUE, `selected-text-format` = pasgte0("count > ", length(mychoices)),`count-selected-text` = "TOTAL"),
      multiple = TRUE
    )
  )
)


server <- function(input, output) {}

shinyApp(ui = ui, server = server)

enter image description here