Learn R Programming

shinyga (version 0.1.2.9001)

initMessageData: initMessageData - creates Message object

Description

Use this first before addMessageData adds to the notification menu when stuff happens

Usage

initMessageData(text = c("Welcome! Authenticate to get started."), icon = c("smile-o"), status = c("info"))

Arguments

text
Text of message.
icon
Icon taken from shinydashboard.
status
Color of message. See Details.

Value

messageData Object to be passed to addMessageData().

See Also

http://rstudio.github.io/shinydashboard/appearance.html#icons

Other message functions: addMessageData

Examples

Run this code
## Not run: 
# 
# ## server.r
# shinyServer(function(input, output, session) {
# 
#     messageData <- initMessageData()
# 
#     addMessageData(messageData, "A new message!")
# 
#       output$messageMenu <- renderDropdownMenu({
# 
#       message_df <- data.frame(text = messageData$text,
#                                icon = messageData$icon,
#                                status = messageData$status)
# 
#      msgs <- apply(message_df, 1, function(row){
#                    notificationItem(text = row[['text']],
#                                     icon = icon(row[['icon']]),
#                                     status = row[['status']])
# 
#                    })
# 
#      dropdownMenu(type="notifications", .list = msgs)
# 
#      })
# 
# }
# 
# ## ui.r
# 
# dashboardHeader(title = "GA Forecast",
#                 dropdownMenuOutput("messageMenu"))
# ## End(Not run)

Run the code above in your browser using DataLab