Reputation: 51
Is it possible to show all selectizegroupUI options but grey out the unavailable selections based off of what it already selected?
For example, when selecting a Manufacturer, show all other options but grey out if unavailable (and vice versa).
Could one combined the solution below with selectizegroupUI?
Grey out a selectInput choice after clicking a checkboxInput - R Shiny
library(tidyverse)
library(tidylog)
library(dplyr)
library(shiny)
library(shinyWidgets)
library(datamods)
library(reactable)
library(data.table)
library(janitor)
library(readxl)
data("mpg", package = "ggplot2")
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
select_group_ui(
id = "my-filters",
params = list(
manufacturer = list(inputId = "manufacturer", label = "Manufacturer:"),
model = list(inputId = "model", label = "Model:"),
trans = list(inputId = "trans", label = "Trans:"),
class = list(inputId = "class", label = "Class:")
),
vs_args = list(disableSelectAll = FALSE),
inline = FALSE
)
),
mainPanel(
reactableOutput(outputId = "table")
)
)
)
server <- function(input, output) {
res_mod <- select_group_server(
id = "my-filters",
data = reactive(mpg),
vars = reactive(c("manufacturer", "model", "trans", "class"))
)
output$table <- renderReactable(reactable(res_mod()))
}
shinyApp(ui,server)
On a related note, select_group_ui doesn't seem to work/acknowledge NAs if the column name has a space in it - is it possible to overcome this?
mpg <- mpg %>%
mutate(model = if_else(drv == "f" | drv == "r", NA, model)) %>%
rename("Model with space" = "model")
Upvotes: 0
Views: 39