Issue
This Content is from Stack Overflow. Question asked by Richard Martin
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
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.