todos.
Tengo un código JS que funciona en una aplicación Shiny pero ya no funciona cuando lo llamo en un módulo. Supongo que este problema tiene que ver con los espacios de nombres, pero estoy perdido. La ayuda sería muy apreciada.
Funciona cuando no está en un módulo:
actionButton('download_try_2', "Download Plot"), mainPanel(plotlyOutput("wv_test", height = "650"), tags$script('document.getElementById("download_try_2").onclick = function() { var gd = document.getElementById("wv_test"); Plotly.Snapshot.toImage(gd, {format: "png"}).once("success", function(url) { var a = window.document.createElement("a"); a.href = url; a.type = "image/png"; a.download = "plot.png"; document.body.appendChild(a); a.click(); document.body.removeChild(a); }); } ')Cuando intento:
actionButton(NS(id, 'download_try_2'), "Download Plot"), mainPanel(plotlyOutput(NS(id, "wv_test")), tags$script('document.getElementById("wv_test-download_try_2").onclick = function() { var gd = document.getElementById("wv_test-wv_test"); Plotly.Snapshot.toImage(gd, {format: "png"}).once("success", function(url) { var a = window.document.createElement("a"); a.href = url; a.type = "image/png"; a.download = "plot.png"; document.body.appendChild(a); a.click(); document.body.removeChild(a); }); } ')me sale el error:
Error en htmltools::validateCssUnit(width): las unidades CSS deben ser un vector numérico o de caracteres de un solo elemento