Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print Shiny App Screen not working Error: shinyjs: extendShinyjs: `functions` argument must be provided

Tags:

r

shiny

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
like image 768
SportSci Avatar asked Sep 12 '20 13:09

SportSci


1 Answers

Please try

extendShinyjs(text = jsCode, functions = c("winprint")),

instead of

extendShinyjs(text = jsCode),

in your ui.

like image 197
YBS Avatar answered Oct 30 '22 18:10

YBS