我使用Shiny GUI R包.我正在寻找一种在按下actionButton后显示"loading ..."等消息的方法.该函数需要几分钟才能执行,因此我需要以某种方式通知用户按钮实际触发了某个事件.现在server.R代码如下所示:
DATA <- reactive({
if(input$DownloadButton>0) {
RunDownload()
} else {
NULL
}
})
output$Download <- renderText({
if(NROW(DATA())>0) {
paste0(Sys.time(),": ",NROW(DATA()), " items downloaded")
} else {
''
}
})
Run Code Online (Sandbox Code Playgroud)
actionButton()是一种从互联网下载数据的功能.input$DownloadButton是actionButton.因此,在按下按钮后,用户等待几分钟,然后才会看到一条消息,说下载成功.我想在按下actionButton之后显示消息"正在加载...",然后paste0(Sys.time(),": ",NROW(DATA()), " items downloaded")在执行结束时显示另一条消息.
我正在尝试为我的仪表板创建一个加载页面,但我似乎无法让它工作。我按照这里的例子;闪亮的仪表板 - 显示一个专用的“加载..”页面,直到数据的初始加载完成,但它是用于流体页面而不是闪亮的仪表板,我不知道如何调整它。
任何帮助,将不胜感激!
我希望加载页面只是一个流畅的页面(没有标题或侧边栏),然后让我的主仪表板具有闪亮的仪表板方面。
额外:如果我可以在加载屏幕上添加一个 gif,那就太棒了。就像是:
<iframe src="https://giphy.com/embed/BlmF3MhGfa4SY" width="480" height="360" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/plane-BlmF3MhGfa4SY">via GIPHY</a></p>
Run Code Online (Sandbox Code Playgroud)
[休息]
library (shiny)
library (shinydashboard)
library(shinyjs)
rm(list=ls())
appCSS <- "
#loading_page {
position: absolute;
background: #000000;
opacity: 0.9;
z-index: 100;
left: 0;
right: 0;
height: 100%;
text-align: center;
color: #FFFFFF;
}
"
header <- dashboardHeader()
sidebar <- dashboardSidebar()
body <- dashboardBody("It worked!")
ui <- dashboardPage(
useShinyjs(),
inlineCSS(appCSS),
div(
id = "loading_page",
dashboardHeader(),
dashboardSidebar(),
dashboardBody("Loading...")
),
hidden(
div(
id = "main_content",
header, sidebar, …Run Code Online (Sandbox Code Playgroud)