Below is the sample application where I have put spinner loading. But the issue is , even before the action button is pressed, the spinner is been seen. Actually, only when action button is pressed, it should come. I know this can be achieved by adding eventReactive
, but is there a way to achieve this only by using observeEvent
library(shiny)
library(dplyr)
library(shinycssloaders)
library(DT)
ui <- fluidPage(
actionButton("plot","plot"),
withSpinner(dataTableOutput("Test"),color="black")
)
server <- function(input, output, session) {
observeEvent(input$plot, {
output$Test <- DT::renderDT(DT::datatable(head(iris),
rownames = FALSE, options = list(dom = 't',
ordering=FALSE)))
})
}
shinyApp(ui = ui, server = server)