Search code examples
rshiny

shinycssloader keeps loading even after activity is finished


tabPanel("Call Tab",

                 wellPanel(style = "background: white",
                      wellPanel(style = "background: #ff6666",
                              h4("Case1:EWS&0Count"),
                              h5("Check")
                      ),        

                    formattableOutput("case1.Table")  %>% withSpinner()

                  ),

The withSpinner of shinycssloaders package keeps on loading even after the table output is generated.


Solution

  • You need to drop the dot in your output name ("case1Table" instead of "case1.Table") Please see the following:

    library(shiny)
    library(formattable)
    
    
    ui <- fluidPage(
        titlePanel("formattableOutput withSpinner"),
    
        sidebarLayout(sidebarPanel(),
    
                      mainPanel(tabsetPanel(
                          tabPanel(
                              "Call Tab",
                              wellPanel(
                                  style = "background: white",
                                  wellPanel(style = "background: #ff6666",
                                            h4("Case1:EWS&0Count"),
                                            h5("Check")),
                                  withSpinner({formattableOutput("case1Table")})
                              )
                          )
                      )))
    )
    
    server <- function(input, output) {
        output$case1Table <- renderFormattable({
            formattable(data.frame(replicate(10, runif(10, 0, 10))))
        })
    }
    
    shinyApp(ui = ui, server = server)