的部分createAlert
不起作用。任何人都可以帮我解决它吗?任何帮助表示赞赏。
library(shiny)
library(shinyBS)
shinyUI(fluidPage(
titlePanel("Ouais...Ouais..."),
sidebarLayout(
sidebarPanel(
helpText("A new learner"),
selectInput("var",
label = "Choose a variable to display",
choices = c("begin", "win", "again", "give up"),
selected = "begin"),
radioButtons(
"filtre",
label = h5("Do you like me ?"),
choices = list("Yes" = 1, "No" = 0, "Get out" = 2),
selected = 1),
actionButton("initia", label = img(src="imgR.png", height = 200, width = 170) )
),
mainPanel(
**bsAlert("alert1"),**
textOutput("text1"),
textOutput("text2")
)
)
))
library(shiny)
library(shinyBS)
shinyServer(function(input, output, session) {
output$text1 <- renderText({
paste("You have selected", input$var)
})
output$text2 <- renderText({
paste("Do you want to go ? ", input$filtre)
})
**output$textalert <- renderText({
popupvar <- input$var
if(popupvar == "give up") {
createAlert(session, "alert1", "exampleAlert", title = "Oops",
content = "Go on, you'll win", append = FALSE)
} else if(popupvar == "begin") {
createAlert(session, "alert1", "exampleAlert", title = "Oops",
content = "Bravo.", append = FALSE)
} else {
closeAlert(session, "exampleAlert")
return("Greateful")
}
})**
observe({
input$initia
updateSelectInput(session, "var", selected = "begin")
updateRadioButtons(session, "filtre", selected = 1 )
})
})