为什么我不能去掉RShiny中的下拉箭头?

hfyxw5xn  于 2023-03-15  发布在  其他
关注(0)|答案(1)|浏览(161)

我想得到一个固定的侧边栏没有任何下拉箭头。找不到任何有关我的问题,在RShiny,这是我有。
但是我想要没有箭头的工具。下面是初始代码:

app_ui <-
        shiny::fluidPage(
          theme = shinythemes::shinytheme("united"),
          
          tags$head(tags$style(".navbar {margin-bottom: 0px;}")),
          
          tags$head(
            tags$style(".container-fluid {padding-right: 0px; padding-left: 0px;}")
          ),
        
        # Your application UI logic
            navbarPage(
              title = div(
                img(src = "www/bftb_logo_v8_bare.png", height = "30px"),
                "AZ Oncology Bioinformatics Toolbox"
              ),
              windowTitle = "BFTB Landing Page",
            
            # windowTitle = "BFTB Landing Page",
            # title = div(img(src = "www/bftb_logo_v8_bare.png", height = "30px"), "AZ Oncology Bioinformatics Toolbox"),
            # theme = shinythemes::shinytheme("cerulean"),
            tabPanel("Toolbox", icon = icon("wrench"),disable = TRUE,
                     shinydashboard::dashboardPage(
                      header = shinydashboard::dashboardHeader(title = "   ", titleWidth = 300, disable = TRUE),
                       shinydashboard::dashboardSidebar(
                         width = 300 ,
                         shinydashboard::sidebarMenu(
                           shinydashboard::menuItem(
                             "Tools",
                             tabName = "tools_app",
                             icon = icon("wrench"),
                             shinydashboard::menuSubItem(
                               "Gene Expression/Signature/Pathways",
                               tabName = "gene_app",
                               icon = icon("chart-line")
                             ),
                           etc, etc,

我尝试在sideBarMenu中添加一行新代码

id = 'sidebar',
 style = "position: relative; overflow: visible;",

并插入更广泛的代码:

app_ui <- shiny::fluidPage(),
            navbarPage(
              title = div(
                img(src = "www/my.png", height = "30px"),
                "Toolbox"
              ),
              windowTitle = "BFTB Landing Page",
            
            # windowTitle = "BFTB Landing Page",
            # title = div(img(src = "www/bftb_logo_v8_bare.png", height = "30px"), "AZ Oncology Bioinformatics Toolbox"),
            # theme = shinythemes::shinytheme("cerulean"),
            tabPanel("Toolbox", icon = icon("wrench"),disable = TRUE,
                     shinydashboard::dashboardPage(
                      header = shinydashboard::dashboardHeader(title = "   ", titleWidth = 300, disable = TRUE),
                       shinydashboard::dashboardSidebar(
                         width = 300 ,
                         shinydashboard::sidebarMenu(
                           id = 'sidebar',
                           style = "position: relative; overflow: visible;",
                           shinydashboard::menuItem(
                             "Tools",
                             tabName = "tools_app",
                             icon = icon("wrench"),
                             shinydashboard::menuSubItem(
                               "Gene Expression/Signature/Pathways",
                               tabName = "gene_app",
                               icon = icon("chart-line")
                             ),
                      etc. etc,

但是仍然得到了相同的向下箭头,而没有修复它。现在我认为这可能是由于menuSubItem的功能,因此强制它们作为子项,而不是删除条。因此,我用menuItem编写了代码,并将所有元素放置为'menuItem'
但是当我再次运行应用程序时,我得到了一个错误“body is missing”。很明显,我的代码中有body。请参见图片:
我有我身体部分的代码,这是一个例子.

shinydashboard::dashboardBody(
                     shinydashboard::tabItems(
                       shinydashboard::tabItem("tools_app", mod_tools_path_ui("tools_path_ui_1")),
                       shinydashboard::tabItem("gene_app", mod_gene_expressions_sign_path_ui("gene_expression_sign_path_ui")),

因此,我需要了解为什么我不能得到固定的工具,作为标题的子项目,我在上面的图片。如何解决这个问题?

3pmvbmvn

3pmvbmvn1#

这不是答案。这只是为了展示如何将原始帖子变成可复制的示例。我将在一个小时左右删除它。

library(shinydashboard)
library(shiny)

ui <- dashboardPage(
  header = dashboardHeader(title = ""),
  dashboardSidebar(
    width = 300,
    sidebarMenu(
      menuItem(
        "Menu",
        tabName = "test",
        menuSubItem(
          "SubMenu",
          tabName = "test2"
        )
      )
    )
  ),
  dashboardBody()
)

server <- function(input, output, session) {
  
}

shinyApp(ui, server)

相关问题