How to remove progress bar after process is complete? Could any one help me. I add a progress bar using ShinyWidgets.
UI part
ui <- fluidPage(
column(
width = 7,
tags$b("Other options"), be(),
progressBar(
id = "pb2",
value = 0,
total = 100,
title = "",
display_pct = TRUE,
status = "custom"
),
tags$style(".progress-bar-custom {background-color: #25c484;}"),
DTOutput("intTable")
)
)
Server part
server <- function(input, output, session) {
adae<-read_sas("DATAPATH")## data
for (i in 1:100) {
updateProgressBar(
session = session,
id = "pb2",
value = i, total = 100
)
Sys.sleep(0.1)
}
####==Here I want to close this ProgressBar==######
output$intTable<-renderDT({adae %>%
datatable(rownames = FALSE, options = list(dom = 't', pageLength = 200))
})
}
shinyApp(ui = ui, server = server)
You can use shinyjs
package to hide it after completion
library(shiny)
library(shinyjs)
library(DT)
ui <- fluidPage(
useShinyjs(),
column(
width = 7,
tags$b("Other options"),
div(id = "pb2_vis",
progressBar(
id = "pb2",
value = 0,
total = 100,
title = "",
display_pct = TRUE,
status = "custom"
)
),
tags$style(".progress-bar-custom {background-color: #25c484;}"),
DTOutput("intTable")
)
)
server <- function(input, output, session) {
for (i in 1:10) {
updateProgressBar(
session = session,
id = "pb2",
value = i, total = 10
)
Sys.sleep(0.2)
}
####==Here I want to close this ProgressBar==######
data <- reactive({
head(mtcars)
})
observeEvent(data(),{
hide("pb2_vis")
})
output$intTable<- renderDT({data() %>%
datatable(rownames = FALSE, options = list(dom = 't', pageLength = 200))
})
}
shinyApp(ui = ui, server = server)