R ShinydashboardPlus 2.0.0 相当于 sidebar_fullCollapse或 css

问题描述

有人可以帮助我使用正确的 css 代码以允许我

(1) 让 dashboardControlbar 即右侧边栏(在早期版本的 rightSidebar shinydashboardplus)在启动时打开

(2) 可以选择在点击齿轮图标时完全折叠右侧控制栏

enter image description here

(点击右侧的齿轮不允许右侧控制栏折叠,左侧工作正常)

这篇文章是从 this one which addresses the above scenario but is only valid for the earlier versions of shinydashboardPlus < 2.0.0 开始的,已经有 major breaking changed in the latest version of the package and internal functions have been changed

在下面的示例代码中,我可以通过向正文添加一些标签来实现(1),例如 tags$body(class="skin-blue sidebar-mini control-sidebar-open",dashboardPagePlus(...).

我无法达到 (2)。在以前的版本中,可以使用 sidebar_fullCollapse = TRUE(现在称为 dashboardPagePlus调用 dashboardPage,并且这不再是函数的参数。

我曾尝试将 css 检查器工具与包中的新示例一起使用(版本 2 运行 shinydashboardplusgallery()),但无法弄清楚如何去做或正确的 css 是什么。

library(shiny)
library(shinydashboard)
library(shinydashboardplus)
data(iris)

header <- dashboardHeader(title = "Demo")

sidebar <- dashboardSidebar(
  selectInput(
    inputId = "slect",label = "Selection Menu",selected = "a",choices = LETTERS[1:3]
  ),p("Write something here..."),minified = FALSE
)

body <- dashboardBody(
  tags$script('
      $(".navbar-custom-menu").on("click",function(){
        $(window).trigger("resize");
      })'
  ),fluidPage(
    plotOutput(
      "scatter",height = "700px",width = "100%"
    )
  )
)

controlbar <- dashboardControlbar()

ui <- tags$body(class="skin-blue right-sidebar-mini control-sidebar-open",dashboardPage(header,sidebar,body,controlbar
                              # sidebar_fullCollapse = TRUE))
                ))
                        

server <- function(input,output) {
  output$scatter <- renderPlot({
    plot(iris$Petal.Length,iris$Petal.Width,pch = 21)
    cats <- levels(iris$Species)
    cols <- c("red","blue","yellow2")
    ind <- lapply(cats,function(z)
      which(iris$Species == z))
    for (i in seq(cats)) {
      points(iris$Petal.Length[ind[[i]]],iris$Petal.Width[ind[[i]]],pch = 19,col = cols[i])
    }
  })
}

shinyApp(ui,server)
> sessionInfo()
R Under development (unstable) (2020-10-17 r79346)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  Grdevices utils     datasets  methods   base     

other attached packages:
[1] shinyEffects_0.1.0       styler_1.4.1            
[3] shinyAce_0.4.1           shinyWidgets_0.6.0      
[5] shinyjqui_0.4.0          shiny_1.6.0             
[7] shinydashboardplus_2.0.0 shinydashboard_0.7.1 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...