下面给定的 R Shiny 脚本创建一个具有多个 selectInput 的框面板,如果单击任何 selectInput,滑块将出现在框本身内,请帮助我使其出现在框外部,并且不修改框面板的对齐方式简单来说,输入“splitlayout”需要修复。注意:对齐非常重要,请勿更改。
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
box(title = "Data", status = "primary", solidHeader = T, width = 12,
splitLayout(
cellArgs = list(style = "padding: 10px"),
selectInput("select1","select1",c("A1","A2","A3"), selected = "A1"),
selectInput("select2","select2",c("A3","A4","A5"), selected = "A3"),
selectInput("select2","select2",c("A3","A4","A5"), selected = "A3"),
selectInput("select2","select2",c("A3","A4","A5"), selected =
"A3"),
selectInput("select2","select2",c("A3","A4","A5"), selected = "A3")
))))
server <- function(input, output) { }
shinyApp(ui, server)
如果您找不到更好的解决方案,强制 css (
overflow
of shiny-split-layout
) 值应该会有所帮助。
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
tags$head(tags$style(HTML('.shiny-split-layout>div {overflow:visible}')))
),
dashboardBody(
box(title = "Data", status = "primary", solidHeader = T, width = 12,
splitLayout(
cellArgs = list(style = "padding: 10px"),
selectInput("select1","select1",c("A1","A2","A3"), selected = "A1"),
selectInput("select2","select2",c("A3","A4","A5"), selected = "A3"),
selectInput("select2","select2",c("A3","A4","A5"), selected = "A3"),
selectInput("select2","select2",c("A3","A4","A5"), selected =
"A3"),
selectInput("select2","select2",c("A3","A4","A5"), selected = "A3")
))))
server <- function(input, output) { }
shinyApp(ui, server)