-
Notifications
You must be signed in to change notification settings - Fork 81
Description
The {crosstalk} package provides functionality to link shiny widgets in two ways: selection and filtering. reactable implements filtering correctly, and when rows in a reactable table are selected then it correctly sends the selection signal. However, when rows are selected externally, reactable does not correctly show the selection - it filters for these rows instead of highlighting them.
In the example below, if you use the filters, then both the plot and the table will show filtered data. This is correct. If you select rows in the table, then the corresponding data points will highlight in the plot. This is also correct. But if you highlight points in the plot, then the table will filter out the other data instead of highlighting the selected data.
library(shiny)
df <- crosstalk::SharedData$new(cars)
ui <- fluidPage(
crosstalk::filter_slider("speed", NULL, df, "speed"),
d3scatter::d3scatterOutput("plot"),
reactable::reactableOutput("table")
)
server <- function(input, output, session) {
output$plot <- d3scatter::renderD3scatter({
d3scatter::d3scatter(df, ~speed, ~dist)
})
output$table <- reactable::renderReactable({
reactable::reactable(df, selection = "multiple")
})
}
shinyApp(ui, server)