I have 4 dependent selection fields realized with selectizeGroup functions. I would like to limit the number of choices to only one item in each field. Is it possible?
The code below works like a charm for multiple selections in each field. I would like to limit the selections so only picking one is possible. Where and what parameter to add if it exists?
Here is my working selectizeGroup application:
ui <- fluidPage(
fluidRow(
column(
width = 10, offset = 1,
tags$h3("Filter data with selectize group"),
panel(
selectizeGroupUI(
id = "my-filters",
inline = TRUE,
params = list(
p_lev5 = list(
inputId = "p_lev5",
title = "Level 5",
placeholder = 'select',
options = list(limit = 1)
),
p_min = list(
inputId = "p_min",
title = "Group minor",
placeholder = 'select'
),
sm = list(
inputId = "sm",
title = "Manager",
placeholder = 'select'
),
rp = list(
inputId = "rp",
title = "Representative",
placeholder = 'select'
)
),
),
status = "primary"
),
plotOutput("plot1")
)
)
)
server = function(input, output, session) {
res_mod <- callModule(
module = selectizeGroupServer,
id = "my-filters",
data = df_prc_ch_minor,
vars = c("p_lev5", "p_min", "sm", "rp")
)
output$plot1 <-
renderPlot({
req( input[["my-filters-p_lev5"]],
input[["my-filters-p_min"]],
input[["my-filters-sm"]],
input[["my-filters-rp"]])
fn_plt_prcech(
input[["my-filters-p_lev5"]],
input[["my-filters-p_min"]],
input[["my-filters-sm"]],
input[["my-filters-rp"]])
})
}
shinyApp(ui, server)
The part options = list(limit = 1)
is what I dream about, of course. Thank you for all the indications.