如何在闪亮的仪表板中扩展背景

mum*_*ass 5 r shiny shinydashboard

这是一个闪亮的仪表板应用程序的一小段(愚蠢的)代码:

    library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(uiOutput("choices")),
  dashboardBody()
)

server <- function(input,output) {
  output$choices <- renderUI(radioButtons("blabla", NULL, 1:100))
}

shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)

当您运行此代码时,您会发现如果向下滚动,右侧的漂亮背景会突然切换为黑色。即使向下滚动并使用 ui-elements,如何确保整个页面的背景保持良好且均匀?

And*_*rau 9

我知道这是一个老问题,但我在这里添加是为了后代。我没有找到令人满意的固定高度,因为它添加了永久滚动条。

使用.content-wrapper { overflow: auto; }似乎按我的预期工作。IE:

dashboardPage(
    dashboardHeader(),
    dashboardSidebar(
        # ...
    ),
    dashboardBody(

        # ...

        tags$head(tags$style(HTML('.content-wrapper { overflow: auto; }')))
    )
)
Run Code Online (Sandbox Code Playgroud)


Ale*_*ndr 3

只需将固定高度覆盖到您的.content-wrapper类即可。

library(shiny)
library(shinydashboard)

ui <- dashboardPage(

    dashboardHeader(),
    dashboardSidebar(
        tags$head(tags$style(HTML('.content-wrapper { height: 3000px !important;}'))),
        uiOutput("choices")),
    dashboardBody()
)

server <- function(input,output) {
    output$choices <- renderUI(radioButtons("blabla", NULL, 1:100))
}

shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)