UPDATE: I posted a related question here
I need to include an html file in shiny using includeHTML. The file is generated by rmarkdown, and has a large number of htmlWidgets.
Shiny is showing the html file, but the htmlWidgests are missing. The problem occurs only when includeHTML is in server.R, but works ok if includeHTLM is in ui.R. I need to update file.html so includeHTML must be used in a reactive context.
The file.rmd is somthing like this
---
title: "test"
author: "me"
date: '`r Sys.Date()`'
output: html_document
---
```{r}
df<- data.frame(a = c(1:10), b = c(1:10))
rpivotTable::rpivotTable(df , rows = 'a' , cols= 'b' )
rpivotTable::rpivotTable(df , rows = 'a' , cols= 'b' )
rpivotTable::rpivotTable(df , rows = 'a' , cols= 'b' )
```
then render to file.html
rmarkdown::render( input = 'file.RMD' )
This shiny app is OK
ui <- shinyUI(
fluidPage(
includeHTML('file.html')
)
)
server <- function(input, output) { }
shinyApp(ui, server)
BUT this one does not work.
ui <- shinyUI(
fluidPage(
uiOutput('tables')
)
)
server <- shinyServer(function(input, output) {
output$tables <- shiny::renderUI(
includeHTML('file.html')
)
})
shinyApp(ui, server)
Just getting a chance to dig into this, and the error I am getting is with the
window.buildTabsets()
from these lines.Fix in YAML
If I render using these yaml options to disable the bootstrap, I get the expected result, but we lose bootstrap.
Confirm?
If possible, will you please verify that this also works on your side?
Better Approach?
In general, I would recommend a different approach, since the rendered html will contain all dependencies, and will be a very large file that gets passed across the websocket. Perhaps, this issue can help describe a potentially better approach.