Closed jessiereese closed 1 year ago
Hello @jessiereese ,
If you re-install package from GitHub you can access inputs values with attr(*, "inputs")
on the module's output, check this example:
library(shiny)
library(datamods)
library(shinyWidgets)
ui <- fluidPage(
# theme = bslib::bs_theme(version = 5L),
fluidRow(
column(
width = 10, offset = 1,
tags$h3("Filter data with select group module"),
shinyWidgets::panel(
select_group_ui(
id = "my-filters",
params = list(
list(inputId = "Manufacturer", label = "Manufacturer:"),
list(inputId = "Type", label = "Type:"),
list(inputId = "AirBags", label = "AirBags:"),
list(inputId = "DriveTrain", label = "DriveTrain:")
)
),
status = "primary"
),
tags$b("Inputs values:"),
verbatimTextOutput("inputs")
)
)
)
server <- function(input, output, session) {
res_mod <- select_group_server(
id = "my-filters",
data = reactive(MASS::Cars93),
vars = reactive(c("Manufacturer", "Type", "AirBags", "DriveTrain"))
)
output$inputs <- renderPrint({
attr(res_mod(), "inputs")
})
}
shinyApp(ui, server)
Victor
Hi Victor, Thank you so much! This solution worked beautifully! Cheers, Jessie
Hi Victor! Thank you so much for your work on the
select_group
functions! I would like to use the selected inputs to filter more than one table, and am wondering if this is possible usingselect_group
.I've found examples of using the input from one module as the input for a second module by including the inputs in the return from the first module's server function, and it looks like you've implemented something similar in
filter_data_server()
. Would this be possible to implement inselect_group_server()
, or is there another workaround you can think of that would allow me to re-use the inputs in another table?Thank you!