shinydashboard中dropdownmenu中的反应对象

时间:2017-02-24 18:36:16

标签: r shiny shinydashboard reactive

是否可以根据反应对象呈现仪表板标题dropdownmenu或notificationitem?我的尝试没有用。

library(shiny)
library(shinydashboard)
ui <- dashboardPage(
  dashboardHeader(uiOutput("drop")),
  dashboardSidebar(),
  dashboardBody()
)

server <- function(input, output) { 
  values<-reactiveValues()
  values[["numvotes"]]<-1
  output$drop<-renderUI({
    dropdownMenu(type = "notifications", badgeStatus = "warning",
                 notificationItem(icon = icon("ok", lib = "glyphicon"), status = "danger",
                                  paste(values[["numvotes"]],"vote(s)")
                 )                 )
  })
  }

shinyApp(ui, server)

1 个答案:

答案 0 :(得分:1)

是的,有shinydashboardrenderMenu的{​​{1}}文档对此进行了解释:

https://rstudio.github.io/shinydashboard/structure.html#dynamic-content

dropdownMenuOutput