daattali / shinycssloaders

⌛ Add loading animations to a Shiny output while it's recalculating
https://daattali.com/shiny/shinycssloaders-demo/
Other
399 stars 45 forks source link

using shinycssloaders in rmd document #11

Closed Kvit closed 6 years ago

Kvit commented 6 years ago

is it possible to use shinycssloaders with shiny rmd doc? If so, what are the rules? I'm trying this example and don't see spinner:

`

title: "shinycssloaders" runtime: shiny

library(shiny)
library(shinycssloaders)
test_table<-data.frame(A=rnorm(200), B=rnorm(200))
# should load table with spinner
withSpinner(DT::dataTableOutput("table"))
output$table<- DT::renderDataTable({
  Sys.sleep(2)
  return(test_table)
})

`

andrewsali commented 6 years ago

This appears to be a duplicate of #8 . It's on the roadmap to be addressed, the issue is that Rmarkdown with runtime shiny doesn't seem to process special tags such as tags$head and singleton.

Kvit commented 6 years ago

In Rmarkdown at least some of this functionality is available via YAML header. For example:

title: "mytitle" output: html_document: includes: in_header: my_header.html

will include my_header.html into resulting webpage

Also (in case this is helpful) , you can include shiny functions like: https://shiny.rstudio.com/reference/shiny/latest/addResourcePath.html in r code chunks with context=setup or context=global to execute only once

daattali commented 1 year ago

@Kvit using shinycssloaders in rmarkdown is now possible