闪亮的侧边栏菜单 - 使用子菜单来组织选择输入

时间:2018-04-16 16:52:39

标签: r shiny

我正在尝试使用闪亮创建仪表板。

我的想法是在身体上只创建一个仪表板屏幕。但是,我想在子菜单中分隔每个输入选择:

例如:

Menu

当我点击子菜单向下滚动(红色圆圈)时,我希望看起来是一个输入选择。

Menu2

我正在使用这个脚本:

convertMenuItem <- function(mi,tabName) {
  mi$children[[1]]$attribs['data-toggle']="tab"
  mi$children[[1]]$attribs['data-value'] = tabName
  if(length(mi$attribs$class)>0 && mi$attribs$class=="treeview"){
    mi$attribs$class=NULL
  }
  mi
}

ui <- dashboardPage(
  dashboardHeader(title = "Menu", 
                  dropdownMenu(type = "messages",
                               messageItem(from = "Menu", message = "Welcome"))),

  dashboardSidebar(collapsed = TRUE,
                   sidebarMenu( id = "tabs",
                                convertMenuItem(menuItem("Dashboard", tabName = "dashboard",icon = icon("dashboard"), selected=T,
                                                         menuItem("Catergoria de Conta", newTab = FALSE),
                                                         menuItem("Unidades",  newTab = FALSE )),"charts"))),

如何在menuitem中创建此输入:

selectInput("continents", "Selecione as contas",choices = levels(tbl1$`Contas Resultado`), multiple = TRUE,selected = "Europe"))

1 个答案:

答案 0 :(得分:0)

解决。

ui <- dashboardPage(
  dashboardHeader(title = "Menu", 
                  dropdownMenu(type = "messages",
                               messageItem(from = "Menu", message = "Welcome"))),

  dashboardSidebar(collapsed = TRUE,
                   sidebarMenu( id = "tabs",
                                convertMenuItem(menuItem("Dashboard", tabName = "dashboard",icon = icon("dashboard"), selected=T,
                                                         menuItem("Catergoria de Conta", newTab = FALSE**,selectInput(inputId = "mcm", label = "Some label", multiple = TRUE, choices = unique(tbl1$`Contas Resultado`)))**,menuItem("Unidades",  newTab = FALSE )),"charts"))),