formattable
formattable copied to clipboard
Make formattable work with promises-package
Formattable-rendering is not working in shiny when using promises.
library(shiny)
library(formattable)
library(promises)
library(future)
ui <- fluidPage(
formattableOutput("table")
)
server <- function(input, output, session) {
output$table <- renderFormattable({
future({mtcars}) %...>% formattable()
})
}
shinyApp(ui, server)
This minimal example gives the error:
no applicable method for 'as.htmlwidget' applied to an object of class "promise"
which seems to missing handling of how to convert a future-formattable into a html-widget in the renderFormattable
-function.
https://rstudio.github.io/promises/
Would you like to provide an example where other htmlwidget works with promises?
I think this might be a place where its resolved in the DT-package: https://github.com/rstudio/DT/blob/c4cf873af528e5d28faa587246077f86709894a3/R/shiny.R#L81-L89
I would be very interested in this too, any progress? I can't speak for the DT implementation, but hmtlWidget::shinyRenderWidget
is supposed to support promises now, so I am not sure what the problem is and how to solve it.