首页 > 解决方案 > shinydashboard:如何将 menusubitem 放在超链接之外

问题描述

我正在使用 shinydashboard 并且在 dashboardSidebar 中我需要在 menusubitem 中选择一些元素。当我使用 control 或 shift 按钮在 selectInput 中选择多个元素时,将打开一个新的 chrome 页面。当我直接在 Rstudio 中尝试时,没有问题。

看起来仪表板将 menusubitem 放置在超链接中(由 Dean Attali 建议)。

我怎样才能避免这种反应?

谢谢

    shinyApp(
    ui = dashboardPage(skin = 'blue',
        dashboardHeader(title = 'reprexes', titleWidth = 450),
        dashboardSidebar(width = 350,

            tags$style('.fa-table {color:#33cc33}'),     
            tags$style('.table2 {color:#0099ff}'),     

            sidebarMenu(width = 350,
            menuSubItem( p(''),
            icon = NULL),
            menuItem('Example1', icon = icon('table'),
            menuSubItem(uiOutput('col_sel'),icon = NULL)

            )
            ) # sidebarMenu
        ), # dashboardSidebar


        dashboardBody(    
            tabBox(width = '500px',

            tabPanel('Instructions', 
            h4('Plots') )   # tabPanel
            )   # tabBox
        )
    ),
    server = function(input, output, session) {
        output$col_sel <- renderUI({
        cn <-c('New York', 'Paris', 'Pekin')
        selectInput('var_1', 'Select the variables', 
        choices  = cn,
        selected = 1,
        multiple=TRUE, selectize=FALSE)
        })
    }
)

标签: hyperlinkshinydashboard

解决方案


推荐阅读