首页 > 解决方案 > 如何在闪亮的应用程序中禁用 checkboxGroupInput 中的多项选择

问题描述

我的闪亮应用中有一个checkboxGroupInput。似乎始终启用多项选择。我需要的是禁用多项选择,一次只允许一个选择。

有谁知道这是怎么做到的吗?下面闪亮的应用程序示例:

ui <- fluidPage(
        checkboxGroupInput("icons", "Choose icons:",
                           choiceNames =
                               list(icon("calendar"), icon("bed"),
                                    icon("cog"), icon("bug")),
                           choiceValues =
                               list("calendar", "bed", "cog", "bug")
        ),
        textOutput("txt")
    )

    server <- function(input, output, session) {
        output$txt <- renderText({
            icons <- paste(input$icons, collapse = ", ")
            paste("You chose", icons)
        })
    }

    shinyApp(ui, server)

这是checkboxGroupInput功能。我很惊讶没有像multiple. 我应该使用其他小部件来达到这个目的吗?我应该使用什么?

checkboxGroupInput(inputId, label, choices = NULL, selected = NULL,
  inline = FALSE, width = NULL, choiceNames = NULL,
  choiceValues = NULL)

标签: rshinyshinywidgets

解决方案


推荐阅读