-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow additional text in progressSweetAlert and updateProgressBar #671
Comments
Hello, library(shiny)
library(shinyWidgets)
ui <- fluidPage(
actionButton("show", "Show progress")
)
server <- function(input, output, session) {
observeEvent(input$show, {
sendSweetAlert(
session = session,
title = NULL,
btn_labels = NA,
text = tags$div(
progressBar(
id = "myprogress",
title = "Work in progress",
display_pct = TRUE,
value = 0
),
tags$div(
id = "mytext",
tags$p("Here you can put some text")
)
),
closeOnClickOutside = FALSE,
backdrop = TRUE
)
for (i in seq_len(50)) {
Sys.sleep(0.1)
updateProgressBar(
session = session,
id = "myprogress",
title = "Work in progress",
value = i*2
)
if (i == 25) {
removeUI("#mytext p", immediate = TRUE)
insertUI(
selector = "#mytext",
ui = tags$p("This text has been updated"),
immediate = TRUE
)
}
}
closeSweetAlert(session = session)
})
}
shinyApp(ui, server) There's also some alternative for a progress modal here : https://dreamrs.github.io/shinybusy/reference/modal-progress.html if you're interested. Victor |
Thank you very much @pvictor , this is super useful. I tried the |
Also tested your solution for the progress bar, it works well. The style of |
Hi!
This is more of a feature request than an issue. Currently, we are able to create
sweetAlerts
of various types with a title and text:We are also able to use a progress bar modal in a sweet alert:
In the documentation, it says that progressSweetAlert's remaining arguments are passed to sendSweetAlert:
... Arguments passed to sendSweetAlert()
However that doesn't extend to the
text
argument, because if I use it, I get:My guess is that
text
is overloaded to contain the progress bar. Is there a way, however, to makeprogressSweetAlert
andupdateProgressBar
accept some additional text? It would help building more dynamic and informative progress bars.Even if this suggestion is rejected, any workaround is also appreciated!
The text was updated successfully, but these errors were encountered: