formattable icon indicating copy to clipboard operation
formattable copied to clipboard

Can we use crosstalk with formattable?

Open shashj opened this issue 6 years ago • 1 comments

Hi, I had a query, don't know where to ask. Can we use formattable with crosstalk? Is it also possible to use datatables, crosstalk and formattable together?

@renkun-ken

shashj avatar Jan 04 '20 16:01 shashj

For context: The {crosstalk} package allows different shiny widgets on a page to interact with each other

Here is an example of code that should work once crosstalk is enabled:

library(shiny)

df <- crosstalk::SharedData$new(cars)

ui <- fluidPage(
  crosstalk::filter_slider("speed", NULL, df, "speed"),
  d3scatter::d3scatterOutput("plot"),
  formattable::formattableOutput("table")
)

server <- function(input, output, session) {
  output$plot <- d3scatter::renderD3scatter({
    d3scatter::d3scatter(df, ~speed, ~dist)
  })
  output$table <- formattable::renderFormattable({
    formattable::formattable(df)
  })
}

shinyApp(ui, server)

daattali avatar Apr 14 '23 06:04 daattali