Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.2k views
in Technique[技术] by (71.8m points)

r - Is it possible set params in a shiny app and send these to a function in JavaScript?

I wonder if it is possible to send a json file from shiny and call a function in javascript that uses this json file as a parameter.

This is my server

server <-  function(input, output, session){
  jsonstring <- read_json("Documents/HelloWorld.json")

  output$table2 <- renderTable({
    #json_test
    session$sendCustomMessage("OpenJSON", jsonstring)
  })
}

And this is how I tried to pass my JSON file through the shiny app to javaScript

Shiny.addCustomMessageHandler("OpenJSON", download);

download() is my javascript function that I want to call in my shinyApp

But unfortunately, this did not work. How can I solve this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...