Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple filter_select with subsetting choices #149

Open
micboat opened this issue Jun 1, 2024 · 0 comments
Open

multiple filter_select with subsetting choices #149

micboat opened this issue Jun 1, 2024 · 0 comments

Comments

@micboat
Copy link

micboat commented Jun 1, 2024

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
)

@micboat micboat changed the title multiple select_filter with subsetting choices multiple filter_select with subsetting choices Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant