下面给出的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)
答案 0 :(得分:1)
如果您没有找到更好的解决方案,强制css(overflow
)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)