Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upsendSweetAlert no html option anymore #48
Comments
|
Hello, I added argument shinyApp(
ui = fluidPage(
tags$h1("Click the button"),
actionButton(
inputId = "success",
label = "Launch a success sweet alert"
)
),
server = function(input, output, session) {
observeEvent(input$success, {
sendSweetAlert(
session = session,
title = "Success !!",
text = "All in order",
type = "success",
closeOnClickOutside = FALSE
)
})
}
)
|
|
Hello, thank you very much for your update and thanks for the package it is very useful! |
|
With a little JavaScript, argument Try : library("shiny")
library("shinyWidgets")
shinyApp(
ui = fluidPage(
tags$h1("Click the button"),
actionButton(
inputId = "sw_html",
label = "Sweet alert with HTML"
)
),
server = function(input, output, session) {
observeEvent(input$sw_html, {
sendSweetAlert(
session = session,
title = "Success !!",
text = tags$span(
"In", tags$b("bold"), "and", tags$em("italic"),
tags$br(),
"and",
tags$br(),
"line",
tags$br(),
"breaks"
),
html = TRUE,
type = "success"
)
})
}
)Victor |
|
Amazing! Very nice features thank you. Romain |
|
just updated R and shinyWidgets, this example throws: |
|
have you installed the dev version of shinyWidgets?
|
|
yes just did, still same result
Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): |
|
the dev version is shinyWidgets_0.4.1.910. Try to remove it and re-install using the code I provided above. |
|
Have you plan to do the same on the |
|
Yes, it works in the latest version. I tried to go further by passing input/output, it seems to work but I don't know if it is very robust. Thanks for the improvement suggestion, it was cool to do. If you want to try it : library("shiny")
library("shinyWidgets")
library("ggplot2")
shinyApp(
ui = fluidPage(
tags$h1("Click the button"),
actionButton(
inputId = "sw_html",
label = "Sweet alert with ggplot"
),
tags$style(".swal-modal {width: 70%;}")
),
server = function(input, output, session) {
observeEvent(input$sw_html, {
sendSweetAlert(
session = session,
title = "Yay an histogram!",
text = tags$div(
plotOutput(outputId = "plot"),
sliderInput(
inputId = "slider", label = "Number of bins",
min = 20, max = 90, value = 60, width = "100%"
)
),
html = TRUE
)
})
output$plot <- renderPlot({
ggplot(diamonds, aes(carat)) +
geom_histogram(bins = input$slider)
})
}
) |
|
you rock! This is really a good package thanks for all your updates. |
|
maybe it's a problem on my side but the
|
|
You have to use argument library("shiny")
library("shinyWidgets")
ui <- fluidPage(
actionButton(
inputId = "go",
label = "Launch confirmation dialog"
)
)
server <- function(input, output, session) {
observeEvent(input$go, {
sendSweetAlert(
session = session, type = "warning", title = NULL,
text = HTML("Is the HTML </br>Working or not?"), html = TRUE
)
})
}
shinyApp(ui = ui, server = server) |
|
Hi Victor!
no matter if it is set to TRUE or FALSE Removing sendSweetAlert from the observeEvent would solve the problem. But this is not what I want to do :) |
|
Hello David, Victor |
|
I confirm the problem is fixed using:
as well as paracetamol ^_^ Cheers |
I was wondering why the HTML = T option on the sendSweetAlert function has been remove? Is there a solution to use the same code as before to have some html text display in the sweet alert?
Also, is it possible not to close the alert when we click outside the popup?
Thanks