I have a shiny app that has a print screen button, but after updating the shinyjs package, the code no longer works.
I got this solution from RShiny print current page and it used to work, but not any more.
Here's the code:
library(shiny)
library(shinyjs)
library(V8)
jsCode <- 'shinyjs.winprint = function(){
window.print();
}'
ui <- shinyUI(fluidPage(
useShinyjs(),
extendShinyjs(text = jsCode),
actionButton("print", "PRINT")
))
server <- shinyServer(function(input, output) {
observeEvent(input$print, {
js$winprint()
})
})
shinyApp(ui, server)
But I get the below error now and the app won't deploy anymore.
Error: shinyjs: extendShinyjs: `functions` argument must be provided
Please try
extendShinyjs(text = jsCode, functions = c("winprint")),
instead of
extendShinyjs(text = jsCode),
in your ui
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With