Hi, I use shiny inside RMarkdown frequently.
The shinyjs package is wonderful for controlling and customizing HTML elements.
https://trials.shinyapps.io/simplebayesdecision-fancy/
&and switch the "horizontal axis" parameter choice; see the numericInputs change.
But it only works if using the shinyApp(ui, server)
call.
In that case a frustrating scrollbar appears, making the page harder to use.
If instead you run the server code in a chunk and output the ui,
scrollbar is gone, yippee, but shinyjs fails silently.
simplebayesdecision-fancy-no-shinyjs/
wantShinyJstoWork = FALSE
if(wantShinyJstoWork) {
shinyApp(ui = ui, server = server)
} else {
server(input, output)
ui
}
I use calls like
runjs("document.getElementById('specDefault').style.color = 'blue'")
Curiously, when wantShinyJstoWork = FALSE
, nevertheless these calls work in the browser console...
and when wantShinyJstoWork = TRUE
, they don't!
So some kind of scoping or namespace issue I guess.