Skip to content

multiple filter_select with subsetting choices  #149

@micboat

Description

@micboat

Hi

Am not sure how to ensure that muni_filter shows only "A" to "E" as choice to select from after selecting "North" in region_filter. Is that possible with crosstalk. Here is my example in R,

Sample data

df <- data.frame(
region = rep(c("North", "South", "East", "West"), each = 5),
muni = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"),
value = runif(20, 10, 100)
)

Create shared data objects

sd <- SharedData$new(df, key = ~muni, group = "shared_group")

Region filter

region_filter <- filter_select(
id = "region",
label = "Select Region:",
sharedData = sd,
group = ~region,
multiple = FALSE
)

Municipality filter

muni_filter <- filter_select(
id = "muni",
label = "Select Municipality:",
sharedData = sd,
group = ~muni,
multiple = FALSE
)

Arrange the filters in a column layout

filter_panel <- bscols(
widths = c(4, 4),
region_filter,
muni_filter
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions