So this is the functionality I want, but I want to use flexdashboard... Is this even possible? In particular I want the user to be able to filter the table and then click to make the final selection.
library(shiny)
library(DT)
#>
#> Attaching package: 'DT'
#> The following objects are masked from 'package:shiny':
#>
#> dataTableOutput, renderDataTable
library(shinyWidgets)
ui <- fluidPage(
selectizeGroupUI(
id = "my-filters",
params = list(
var_one = list(inputId = "speed", title = "Speed", placeholder = 'select'),
var_two = list(inputId = "dist", title = "Distance", placeholder = 'select')
)
),
fluidRow(
column(6, DT::dataTableOutput('x1')),
column(6, plotOutput('x2', height = 500))
)
)
server <- function(input, output, session) {
res_mod <- callModule(
module = selectizeGroupServer,
id = "my-filters",
data = cars,
vars = c("speed", "dist")
)
output$x1 = DT::renderDataTable(res_mod(), server = TRUE, selection = 'single')
output$x2 = renderPlot({
row_selected = input$x1_rows_selected
par(mar = c(4, 4, 1, .1))
plot(cars)
if (length(row_selected)>0) points(res_mod()[row_selected, ], pch = 19, cex = 2)
})
}
shinyApp(ui, server)
Created on 2022-09-17 with reprex v2.0.2