【问题标题】:Right sidebar open by default in shinydashboardPlusShinydashboardPlus 中默认打开右侧边栏
【发布时间】:2020-03-04 12:19:23
【问题描述】:

有没有办法在shinydashboardPlus中默认打开右侧边栏?

library(shiny)
library(shinydashboard)
shinyApp(
  ui = dashboardPagePlus(
    header = dashboardHeaderPlus(
      enable_rightsidebar = TRUE,
      rightSidebarIcon = "gears"
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
    rightsidebar = rightSidebar(
      background = "dark",
      rightSidebarTabContent(
        id = 1,
        title = "Tab 1",
        icon = "desktop",
        active = TRUE,
        sliderInput(
          "obs",
          "Number of observations:",
          min = 0, max = 1000, value = 500
        )
      )
    ),
    title = "Right Sidebar"
  ),
  server = function(input, output) { }
)

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    您必须将 css 类 control-sidebar-open 添加到仪表板的正文标签中。

    这可以按如下方式完成:

    library(shiny)
    library(shinydashboard)
    library(shinydashboardPlus)
    
    shinyApp(
      ui = tags$body(class="skin-blue sidebar-mini control-sidebar-open", dashboardPagePlus(
        header = dashboardHeaderPlus(
          enable_rightsidebar = TRUE,
          rightSidebarIcon = "gears"
        ),
        sidebar = dashboardSidebar(),
        body = dashboardBody(
        ),
        rightsidebar = rightSidebar(
          background = "dark",
          rightSidebarTabContent(
            id = 1,
            title = "Tab 1",
            icon = "desktop",
            active = TRUE,
            sliderInput(
              "obs",
              "Number of observations:",
              min = 0, max = 1000, value = 500
            )
          )
        ),
        title = "Right Sidebar"
      )),
      server = function(input, output) {
      }
    )
    

    请找到一些相关信息herehere

    【讨论】:

    • 右侧边栏也可以固定为永久打开吗?
    • Link 供未来的读者阅读。
    猜你喜欢
    • 2020-12-28
    • 2020-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-29
    • 1970-01-01
    • 1970-01-01
    • 2020-12-29
    相关资源
    最近更新 更多