title: How do you call a javascript method on a htmlwidget (jsoneditor) in shiny?
body: <p>I'm trying to use jsonedit from the listviewer package in a shiny app and want to display the tree fully expanded by default. There isn't an option to do this in the jsonedit() function, but the underlying javascript object has an .expandAll() method which should do it. How do I call this method from R shiny? My attempt below doesn't work either in a shiny app or directly in R.</p>
  <pre><code>library(shiny)
  library(listviewer)
  library(magrittr)
  library(htmlwidgets)
  
  x &lt;- list(a=1,b=2,c=list(d=4,e='penguin'))
  
  jsonedit(x, mode = 'view') %&gt;% onRender(&quot;function(el,x,data) {this.expandAll();}&quot;)
  
  shinyApp(
    ui = shinyUI(
      fluidPage(
        jsoneditOutput( &quot;jsed&quot; )
      )
    ),
    server = function(input, output){
      output$jsed &lt;- renderJsonedit({
        jsonedit(x, mode = 'view') %&gt;% onRender(&quot;function(el,x,data) {this.expandAll();}&quot;)
      })
    }
  )
  </code></pre>