initMessageData: initMessageData - creates Message object

Description Usage Arguments Value See Also Examples

Description

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

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## 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)

MarkEdmondson1234/shinyga documentation built on May 7, 2019, 3:34 p.m.