如何在闪亮的反应中隐藏单选按钮

问题描述 投票:0回答:0

如何从我的 Shiny 应用程序中的可反应表中删除单选按钮列,但保留

selection = "single"
参数?

我的代表是基于这个solution

selection = "multiple"
隐藏全/无复选框,我希望我可以做类似的事情来删除单选按钮。

app.R

library(shiny)
library(reactable)

ui <- fluidPage(
  includeCSS("hide_radio.css"),
  titlePanel("Hide radio buttons"),
  mainPanel(reactableOutput("table"))
)

server <- function(input, output) {
    output$table <- renderReactable({
      reactable(
        mtcars,
        selection = "single",
        columns = list(
          .selection = colDef(
            headerStyle = list(pointerEvents = "none")
          )
        ),
        theme = reactableTheme(
        headerStyle = list("& input[type='checkbox']" = list(display = "none"))
        )
      )
    })
}

shinyApp(ui = ui, server = server)

hide_radio.css

.hide-checkbox {
  pointer-events: none;
}

.hide-checkbox input[type='checkbox'] {
  display: none;
}
r shiny reactable
© www.soinside.com 2019 - 2024. All rights reserved.