在 R shiny 中完成 100% 后是否可以关闭或删除 shinyWidgets 的进程栏?
Is it Possible to close or remove processbar of shinyWidgets after complete 100% in R shiny?
进程完成后如何去除进度条?任何人都可以帮助我。我使用 ShinyWidgets 添加了一个进度条。
UI部分
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 <- 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)
完成后可以使用shinyjs
包隐藏
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)
进程完成后如何去除进度条?任何人都可以帮助我。我使用 ShinyWidgets 添加了一个进度条。
UI部分
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 <- 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)
完成后可以使用shinyjs
包隐藏
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)