JohnCoene / waiter

🕰️ Loading screens for Shiny
https://waiter.john-coene.com/
Other
495 stars 25 forks source link

issue using waiter with DT #106

Closed noamanemobidata closed 2 years ago

noamanemobidata commented 3 years ago

Hi John!

I try to use waiter in my app, but I have a problem when showing the DT table after a waiting screen: the scroller in the table is not working. Here is an example:

I'm using waiter 0.2.2 and DT 0.19


library(shiny)
library(waiter)

ui <- fluidPage(
  use_waiter(),
  actionButton(inputId = "proc", label = "Process"),
  actionButton(inputId = "md",label = "Show modal") 

)

server <- function(input, output, session) {

  output$dt<- renderDataTable({

    datatable( iris,
               width = '100%',rownames = FALSE,
               style="bootstrap4",
               class= "hover compact",
               escape = F,
               extensions = c("Scroller"),
               options = list(
                 fixedHeader = TRUE,
                 scrollX = T,
                 scrollY=  '38vh',
                 scrollCollapse=T,
                 scroller = TRUE,
                 initComplete = JS(
                   "function(settings, json) {",
                   "$(this.api().table().header()).css({'background-color': '#e0e0e0'});",
                   "}"
                 )
               )
    )

  })

  observeEvent(input$md, {

    showModal(

      modalDialog(title = NULL, DTOutput("dt") )

    )

  })

  observeEvent(input$proc,{

    waiter_show()

    Sys.sleep(2)

    waiter_hide()

  })

}

shinyApp(ui, server)
JohnCoene commented 2 years ago

Apologies, this issue escaped me but I just saw the notification that this was closed. Has it been fixed? May I help?