I'd like to have one pickerinput limit the options in the Selectize Group module of ShinyWisgets. I can get that to work using a reactive expression. However, nothing is produced in the table for me to view the results. What am I missing?
I suspect I made an error in the mpg_filter expression.
# https://dreamrs.github.io/shinyWidgets/reference/selectizeGroup-module.html
library(shiny)
library(shinyWidgets)
data("mpg", package = "ggplot2")
ui <- fluidPage(
fluidRow(
column(
width = 10, offset = 1,
tags$h3("Filter data with selectize group"),
panel(
pickerInput(
inputId = "car_select",
choices = unique(mpg$manufacturer),
options = list(
`live-search` = TRUE,
title = "None selected"
),
),
selectizeGroupUI(
id = "my-filters",
params = list(
manufacturer = list(inputId = "manufacturer", title = "Manufacturer:"),
model = list(inputId = "model", title = "Model:"),
trans = list(inputId = "trans", title = "Trans:"),
class = list(inputId = "class", title = "Class:")
)
),
status = "primary"
),
dataTableOutput(outputId = "table")
)
)
)
server <- function(input, output, session) {
mpg_filter <- reactive({
mpg %>%
filter(mpg$manufacturer %in% input$car_select)
})
res_mod <- reactive({
callModule(
module = selectizeGroupServer,
id = "my-filters",
data = mpg_filter(),
vars = c("manufacturer", "model", "trans", "class")
)
})
output$table <- renderDataTable(res_mod())
}
shinyApp(ui, server)