Hi all,
I am trying to incorporate Dropdownmenu in navbar page based on conditions. I have built a following code to achieve that. But unfortunately, the the dropdown is not getting displayed.
Basically, I just gave a condition (4 >3) that is true, then display the dropdown.
library(shiny)
library(lubridate)
library(shinydashboard)
ui <- shinyUI(
fluidPage(
tags$head(
tags$style(HTML("
.navbar-nav .messages-menu a {padding-top: 0px; padding-bottom:0px}
.navbar-nav {width: 90%}
.navbar-nav .messages-menu {float: right; padding-top: 25px;}
"))
),
navbarPage("Navbar!",
tabPanel("Plot",
sidebarLayout(
sidebarPanel(),
mainPanel()
)
),
tabPanel(dropdownMenuOutput("messageMenu")
# dropdownMenu(type = "messages",
# messageItem(
# from = "Sales Dept",
# message = "Sales are steady this month."
# )
# )
)
)
)
)
server <- function(input, output, session) {}
output$messageMenu <- renderMenu({
if(4 > 3){
dropdownMenu(type = "notifications",notificationItem(text = "Open",status = "warning"))
} else {
dropdownMenu()
}
})
shinyApp(ui = ui, server = server)